mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-10 07:11:48 +00:00
refactor: correctly getActiveScope when on modal
This commit is contained in:
parent
b7655e658f
commit
7c3f79ac1a
1 changed files with 5 additions and 3 deletions
|
|
@ -3,11 +3,13 @@
|
|||
import { useEffect, useRef } from 'react';
|
||||
import { useGamepad } from '../GamepadContext';
|
||||
|
||||
const FOCUSABLE = '[tabindex]';
|
||||
const FOCUSABLE = '[tabindex]:not([data-focus-guard])';
|
||||
|
||||
const getActiveScope = (fallback: HTMLDivElement | null): HTMLElement | null => {
|
||||
const modal = document.querySelector<HTMLElement>('.modals-container');
|
||||
if (modal && modal.children.length > 0) return modal;
|
||||
const modals = document.querySelectorAll<HTMLElement>('.modals-container');
|
||||
for (const modal of modals) {
|
||||
if (modal.children.length > 0) return modal;
|
||||
}
|
||||
|
||||
const dropdown = fallback?.querySelector<HTMLElement>('[class*="dropdown"][class*="open"]');
|
||||
if (dropdown) return dropdown;
|
||||
|
|
|
|||
Loading…
Reference in a new issue