Skip to content

Commit

Permalink
FocusTrap: traverse arr instead of NodeList
Browse files Browse the repository at this point in the history
  • Loading branch information
eugpoloz committed Nov 19, 2021
1 parent a08219a commit ab3395f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/FocusTrap/FocusTrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export const FocusTrap: React.FC<FocusTrapProps> = ({

const nodes: HTMLElement[] = [];
// eslint-disable-next-line no-restricted-properties
ref.current?.querySelectorAll(FOCUSABLE_ELEMENTS).forEach((focusableEl) => {
const allFocusableNodes = Array.from(ref.current.querySelectorAll(FOCUSABLE_ELEMENTS));
allFocusableNodes.forEach((focusableEl) => {
const { display, visibility } = window.getComputedStyle(focusableEl);

if (display !== 'none' && visibility !== 'hidden') {
Expand Down

0 comments on commit ab3395f

Please sign in to comment.