Skip to content

Commit

Permalink
fix: fix guard order
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Mar 11, 2019
1 parent c3e068c commit c390b1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/DOMutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const filterFocusable = nodes =>
.filter(node => notHiddenInput(node));

export const getTabbableNodes = (topNodes, withGuards) => (
orderByTabIndex(filterFocusable(getFocusables(topNodes, withGuards)), true)
orderByTabIndex(filterFocusable(getFocusables(topNodes, withGuards)), true, withGuards)
);

export const getAllTabbableNodes = topNodes => (
Expand Down
4 changes: 2 additions & 2 deletions src/utils/tabOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export const tabSort = (a, b) => {
return tabDiff || indexDiff;
};

export const orderByTabIndex = (nodes, filterNegative) =>
export const orderByTabIndex = (nodes, filterNegative, keepGuards) =>
toArray(nodes)
.map((node, index) => ({
node,
index,
tabIndex: node.tabIndex === -1
tabIndex: keepGuards && node.tabIndex === -1
? ((node.dataset || {}).focusGuard ? 0 : -1)
: node.tabIndex,
}))
Expand Down

0 comments on commit c390b1a

Please sign in to comment.