mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: focus traps inside popovers (#5317)
This commit is contained in:
parent
50bc7e099a
commit
af31e9dcc2
4 changed files with 54 additions and 22 deletions
13
src/utils.ts
13
src/utils.ts
|
@ -668,3 +668,16 @@ export const isPromiseLike = (
|
|||
"finally" in value
|
||||
);
|
||||
};
|
||||
|
||||
export const queryFocusableElements = (container: HTMLElement | null) => {
|
||||
const focusableElements = container?.querySelectorAll<HTMLElement>(
|
||||
"button, a, input, select, textarea, div[tabindex], label[tabindex]",
|
||||
);
|
||||
|
||||
return focusableElements
|
||||
? Array.from(focusableElements).filter(
|
||||
(element) =>
|
||||
element.tabIndex > -1 && !(element as HTMLInputElement).disabled,
|
||||
)
|
||||
: [];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue