Skip to content

Commit

Permalink
fix(FloatingMenu): ignore disabled nodes for autofocus (#6679)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrea N. Cardona <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 24, 2020
1 parent d461f83 commit a135f5c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react/src/internal/FloatingMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,10 @@ class FloatingMenu extends React.Component {
const primaryFocusNode = menuBody.querySelector(
this.props.selectorPrimaryFocus || null
);
const tabbableNode = menuBody.querySelector(selectorTabbable);
const focusableNode = menuBody.querySelector(selectorFocusable);
const tabbableNodes = menuBody.querySelectorAll(selectorTabbable);
const focusableNodes = menuBody.querySelectorAll(selectorFocusable);
const tabbableNode = [...tabbableNodes].find((node) => !node.disabled);
const focusableNode = [...focusableNodes].find((node) => !node.disabled);
const focusTarget =
primaryFocusNode || // User defined focusable node
tabbableNode || // First sequentially focusable node
Expand Down

0 comments on commit a135f5c

Please sign in to comment.