diff --git a/src/components/FocusTrap/FocusTrap.tsx b/src/components/FocusTrap/FocusTrap.tsx index 086e1b18675..b6f421e9c64 100644 --- a/src/components/FocusTrap/FocusTrap.tsx +++ b/src/components/FocusTrap/FocusTrap.tsx @@ -55,7 +55,8 @@ export const FocusTrap: React.FC = ({ 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') {