diff --git a/.size.json b/.size.json index 916c962..635c8b2 100644 --- a/.size.json +++ b/.size.json @@ -2,6 +2,6 @@ { "name": "dist/es2015/index.js", "passed": true, - "size": 2536 + "size": 2558 } ] diff --git a/src/utils/is.ts b/src/utils/is.ts index 6b0981b..2422822 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -53,11 +53,14 @@ export const getDataset = (node: Element): HTMLElement['dataset'] | undefined => export const isHTMLButtonElement = (node: Element): node is HTMLInputElement => node.tagName === 'BUTTON'; export const isHTMLInputElement = (node: Element): node is HTMLInputElement => node.tagName === 'INPUT'; + export const isRadioElement = (node: Element): node is HTMLInputElement => isHTMLInputElement(node) && node.type === 'radio'; export const notHiddenInput = (node: Element): boolean => - !((isHTMLInputElement(node) || isHTMLInputElement(node)) && (node.type === 'hidden' || node.disabled)); + !((isHTMLInputElement(node) || isHTMLButtonElement(node)) && (node.type === 'hidden' || node.disabled)) && + // @ts-ignore + !node.ariaDisabled; export const isGuard = (node: Element | undefined): boolean => Boolean(node && getDataset(node)?.focusGuard); export const isNotAGuard = (node: Element | undefined): boolean => !isGuard(node); diff --git a/src/utils/tabbables.ts b/src/utils/tabbables.ts index d4c6a30..99be38a 100644 --- a/src/utils/tabbables.ts +++ b/src/utils/tabbables.ts @@ -6,6 +6,8 @@ export const tabbables = [ 'select:enabled', 'textarea:enabled', 'input:enabled', + // elements with explicit roles will also use explicit tabindex + // '[role="button"]', 'a[href]', 'area[href]',