Skip to content

Commit 5138e4c

Browse files
authored
fix: remove findNodeHandle (#4731)
1 parent e395271 commit 5138e4c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/components/Menu/Menu.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Dimensions,
55
Easing,
66
EmitterSubscription,
7-
findNodeHandle,
87
I18nManager,
98
Keyboard,
109
KeyboardEvent as RNKeyboardEvent,
@@ -117,13 +116,12 @@ const focusFirstDOMNode = (el: View | null | undefined) => {
117116
// When in the browser, we want to focus the first focusable item on toggle
118117
// For example, when menu is shown, focus the first item in the menu
119118
// And when menu is dismissed, send focus back to the button to resume tabbing
120-
const node: any = findNodeHandle(el);
121-
const focusableNode = node.querySelector(
122-
// This is a rough list of selectors that can be focused
123-
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
124-
);
125-
126-
focusableNode?.focus();
119+
if (el instanceof HTMLElement) {
120+
el.querySelector<HTMLElement>(
121+
// This is a rough list of selectors that can be focused
122+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
123+
)?.focus();
124+
}
127125
}
128126
};
129127

0 commit comments

Comments
 (0)