File tree 4 files changed +9
-9
lines changed
react-core/src/components
demo-app-ts/src/components/demos/DropdownDemo
4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
91
91
onOpenChangeKeys = [ 'Escape' , 'Tab' ] ,
92
92
menuHeight,
93
93
maxMenuHeight,
94
- shouldFocusFirstItemOnOpen = true ,
94
+ shouldFocusFirstItemOnOpen = false ,
95
95
...props
96
96
} : DropdownProps ) => {
97
97
const localMenuRef = React . useRef < HTMLDivElement > ( ) ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
88
88
selected,
89
89
toggle,
90
90
shouldFocusToggleOnSelect = false ,
91
- shouldFocusFirstItemOnOpen = true ,
91
+ shouldFocusFirstItemOnOpen = false ,
92
92
onOpenChange,
93
93
onOpenChangeKeys = [ 'Escape' , 'Tab' ] ,
94
94
isPlain,
Original file line number Diff line number Diff line change @@ -43,14 +43,14 @@ describe('Dropdown demo test', () => {
43
43
so testing for a button click should be sufficient
44
44
*/
45
45
46
- it ( 'Autofocuses first item on click by default' , ( ) => {
46
+ it ( 'Does not autofocus first item on click by default' , ( ) => {
47
47
cy . get ( '[data-cy="toggle"]' ) . click ( ) ;
48
- cy . get ( '#first-item' ) . should ( 'be.focused' ) ;
48
+ cy . get ( '#first-item' ) . should ( 'not. be.focused' ) ;
49
49
cy . get ( '[data-cy="toggle"]' ) . trigger ( 'keydown' , { key : 'Escape' } ) ;
50
50
} ) ;
51
- it ( 'Does not autofocus first item on click when shouldFocusFirstItemOnOpen is false ' , ( ) => {
52
- cy . get ( '[data-cy="no- autofocus-toggle"]' ) . click ( ) ;
53
- cy . get ( '#first-item' ) . should ( 'not. be.focused' ) ;
51
+ it ( 'Autofocuses first item on click when shouldFocusFirstItemOnOpen is true ' , ( ) => {
52
+ cy . get ( '[data-cy="autofocus-toggle"]' ) . click ( ) ;
53
+ cy . get ( '#first-item' ) . should ( 'be.focused' ) ;
54
54
cy . get ( '[data-cy="toggle"]' ) . trigger ( 'keydown' , { key : 'Escape' } ) ;
55
55
} ) ;
56
56
} ) ;
Original file line number Diff line number Diff line change @@ -68,12 +68,12 @@ export const DropdownDemo: React.FunctionComponent = () => {
68
68
</ Dropdown >
69
69
< Dropdown
70
70
isOpen = { isNoAutofocusOpen }
71
- shouldFocusFirstItemOnOpen = { false }
71
+ shouldFocusFirstItemOnOpen = { true }
72
72
onOpenChange = { ( isOpen ) => setIsNoAutofocusOpen ( isOpen ) }
73
73
onSelect = { onNoAutofocusSelect }
74
74
toggle = { ( toggleRef ) => (
75
75
< MenuToggle
76
- data-cy = "no- autofocus-toggle"
76
+ data-cy = "autofocus-toggle"
77
77
onClick = { onNoAutofocusToggleClick }
78
78
isExpanded = { isNoAutofocusOpen }
79
79
ref = { toggleRef }
You can’t perform that action at this time.
0 commit comments