File tree 4 files changed +8
-5
lines changed
4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,8 @@ const MenuList = ({
316
316
setItemFocus ( ) ;
317
317
} else if ( captureFocus ) {
318
318
const id = setTimeout ( ( ) => {
319
- if ( ! menuRef . current . contains ( document . activeElement ) ) {
319
+ const menuElt = menuRef . current ;
320
+ if ( menuElt && ! menuElt . contains ( document . activeElement ) ) {
320
321
focusRef . current . focus ( ) ;
321
322
setItemFocus ( ) ;
322
323
}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const createSubmenuCtx = () => {
13
13
pending ( ) ;
14
14
} , closeDelay ) ;
15
15
} else {
16
- settled == null ? void 0 : settled ( ) ;
16
+ settled == null || settled ( ) ;
17
17
}
18
18
} ,
19
19
off : ( ) => {
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ const createSubmenuCtx = () => {
271
271
pending ( ) ;
272
272
} , closeDelay ) ;
273
273
} else {
274
- settled == null ? void 0 : settled ( ) ;
274
+ settled == null || settled ( ) ;
275
275
}
276
276
} ,
277
277
off : ( ) => {
@@ -1172,7 +1172,8 @@ const MenuList = ({
1172
1172
setItemFocus ( ) ;
1173
1173
} else if ( captureFocus ) {
1174
1174
const id = setTimeout ( ( ) => {
1175
- if ( ! menuRef . current . contains ( document . activeElement ) ) {
1175
+ const menuElt = menuRef . current ;
1176
+ if ( menuElt && ! menuElt . contains ( document . activeElement ) ) {
1176
1177
focusRef . current . focus ( ) ;
1177
1178
setItemFocus ( ) ;
1178
1179
}
Original file line number Diff line number Diff line change @@ -374,7 +374,8 @@ export const MenuList = ({
374
374
const id = setTimeout (
375
375
( ) => {
376
376
// If focus has already been set to a children element, don't set focus on menu or item
377
- if ( ! menuRef . current . contains ( document . activeElement ) ) {
377
+ const menuElt = menuRef . current ;
378
+ if ( menuElt && ! menuElt . contains ( document . activeElement ) ) {
378
379
focusRef . current . focus ( ) ;
379
380
setItemFocus ( ) ;
380
381
}
You can’t perform that action at this time.
0 commit comments