Fix supertab
This commit is contained in:
parent
698cd59693
commit
e5333546db
5 changed files with 44 additions and 28 deletions
|
@ -28,3 +28,17 @@ export const focusableSelectors = [
|
|||
`[contenteditable]${not.inert}${not.negTabIndex}`,
|
||||
`[tabindex]${not.inert}${not.negTabIndex}`,
|
||||
];
|
||||
|
||||
export const focusableSelector = focusableSelectors.join(', ');
|
||||
|
||||
/**
|
||||
* Matches the first focusable element within the given element or itself if it
|
||||
* is focusable.
|
||||
*/
|
||||
export function matchOrQueryFocusable(
|
||||
element: HTMLElement
|
||||
): HTMLElement | null {
|
||||
return element.matches(focusableSelector)
|
||||
? element
|
||||
: element.querySelector(focusableSelector);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue