Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Dimensions,
Easing,
EmitterSubscription,
findNodeHandle,
I18nManager,
Keyboard,
KeyboardEvent as RNKeyboardEvent,
Expand Down Expand Up @@ -117,13 +116,12 @@ const focusFirstDOMNode = (el: View | null | undefined) => {
// When in the browser, we want to focus the first focusable item on toggle
// For example, when menu is shown, focus the first item in the menu
// And when menu is dismissed, send focus back to the button to resume tabbing
const node: any = findNodeHandle(el);
const focusableNode = node.querySelector(
// This is a rough list of selectors that can be focused
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
);

focusableNode?.focus();
if (el instanceof HTMLElement) {
el.querySelector<HTMLElement>(
// This is a rough list of selectors that can be focused
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
)?.focus();
}
}
};

Expand Down
Loading