- 18a093f: Add new
getTabIndex()
API which enables Focus-trap to determine tab indexes in the same way as Tabbable when necessary (see focus-trap#974).
- b39b217: Pin jsdom downstream dependency nwsapi to v2.2.2 while awaiting fix (#982)
- 97373cc: Fix JSDom not supporting HTMLElement.inert and HTMLElement.contentEditable APIs, and not supporting CSS selector ':not([inert *])' resulting in no nodes found and "focus-trap must have at least one tabbable node..." error in focus-trap.
- b8c7550: Fix a corner case where a node's root node can be itself, indicating detachment from the DOM, leading to a crash in
isHidden() -> isNodeAttached() -> getRootNode()
if not handled properly (focus-trap-react #905)
- 0aab1e3: Fix crash with tabbable scoped table header elements (#832)
- 5f40c8e: Revised and clarified official browser support (still as broad and deep as reasonably possible).
- 5f40c8e: 🚨 Breaking: Dropped support of IE browsers, all versions.
- IE11 was officially retired on June 15, 2022 (6 weeks ago). There are no longer any versions of IE that are still maintained or even supported by Microsoft.
- a09ba0b: 🚨 Breaking: Default
displayCheck
'full' option no longer treats detached nodes as visible. Use the new 'legacy-full' option to restore old (incorrect) behavior only if you must. Ideally, make sure tabbable only runs once all nodes of interest have been attached to the document.
- 0210a1c: fix: align with browser behaviour when a web component has a negative tabindex
- 320bfd1: Updated docs for
displayCheck
configuration. - aa2a699: Fixed an issue with
displayCheck=full
(default setting) determining all nodes were hidden when the container is not attached to the document. In this case, tabbable will revert to adisplayCheck=none
mode, which is the equivalent legacy behavior. Also updated thedisplayCheck
option docs to add warnings about this corner case for thefull
andnon-zero-area
modes.non-zero-area
behaves differently in the corner case. See the docs for more info.
- cf1da66: Add warnings and help in documentation about running tabbable under JSDom (e.g. with Jest). JSDom is not technically supported, and 5.3.0 introduced some changes that use DOM APIs that JSDom stubs out, which may cause some JSDom-based tests to fail. Also revamp the API docs a bit to make them clearer, and add missing
getShadowRoot
option toisTabbable()
andisFocusable()
(docs only; no code changes necessary).
- 685a906: Adds new Shadow DOM support (must be explicitly enabled using the new
getShadowRoot
option).- When enabled, supports open shadows by default, and can support closed shadows if the option is a function that returns the shadow for a given node. See documentation for more information.
- Includes all updates from
5.3.0-beta.0
and5.3.0-beta.1
releases.
- b341412: Made "isDisabledFromFieldset" more readable and concise (even marginally faster).
- 685a906: Fixed a bug in
getTabIndex
: the tab index of<audio>
,<video>
and<details>
was left to the browser default if explicitly set to a value that couldn't be parsed as integer, leading to inconsistent behavior across browsers. Also slightly modified the function's logic to make it more efficient. Finally added tests to cover the fix. - dd6d0ec: Optimized and extended
displayCheck: "full"
option (now checks for any element having no display boxes) and added test fordisplay: "contents"
property (this bug was never reported). (#592)⚠️ This will likely break your tests if you're using JSDom (e.g. with Jest). See testing in JSDom for more info.
- 193fca2: Fixed bug in
isDisabledFromFieldset
. The function wasn't checking whether the disabled<fieldset>
containingnode
is the top-most disabled<fieldset>
(#596).
- Add support for setting
getShadowRoot: true
as an easy way to simply enable shadow DOM support. This is the equivalent of settinggetShadowRoot: () => false
, which means tabbable will find nodes in open shadow roots only.
- Includes new Shadow DOM support for open shadows by default
- Includes a new
getShadowRoot()
configuration option, enabling support for closed shadows
- 1d5fcb5: Fixed: Form elements in disabled fieldsets should not be tabbable/focusable (#413)
- bf0a8f0: Exposed an option to select the way that an element is checked as displayed
- f9f6d25: Replaces Karma/Mocha/Sinon/Chai in test suite with Jest/Dom Testing Library. Removes README reference to identifying anchor tags with an
xlink:href
attribute as tabbable since that information is incorrect.
- c048203: fix crash when radio button name attributes contain CSS selector special characters (#168)
- a188c71: use element.matches fallback for IE11 and Webkit5
- 0d4cdf8: Update the code to use const/let and function declarations only for the repo; this does NOT affect browser compatibility as the code is still transpiled when published into the
./dist
directory for various targets.
- 5579825: fixes to details elements
- ignore elements nested under a closed details element
- ignore any extra summary elements after the first summary element
- add details element as tabbable in case it has no direct summary element
- d3c6514: Fix UMD build incorrectly using
focusTrap
as output name. - 95563c2: Fix #99: Transpile ESM bundle down to the same browser target used for the CJS and UMD bundles. ESM is just the module system, not the browser target.
- fb49d23: Fix #96: Transpile non-minified bundles for expected browser targets.
- bd21d91: Add
focusable()
for getting all focusable nodes.
- 3665d0b: The TypeScript return type of
tabbable
has been fixed: WasArray<Element>
(anElement
is technically not focusable), is nowArray<HTMLElement | SVGElement>
(which are both still/alsoElement
instances). - 8a25135: Fixed: Tabbable elements in fixed-position (
position: fixed
) containers should now be consistently found in supported browsers. - 9544de2: Replace
prepublishOnly
script withprepare
script. This has the added benefit of running automatically when installing the package from GitHub (as supported by NPM) where the published./dist
directory is not automatically included. - 672f4a2: Add
focusable()
type definition. - 2424c0f: Small improvements for improving tree-shakeability of this package. A missing
#__PURE__
annotation has been added to allow dropping one of the top-level calls (if its result stays unused) and removed minification of the file referenced aspackage.json#module
to avoid dropping the comments (including existing#__PURE__
annotations).
- Changed code formatting to use dangling commas where ES5 supports them.
- Fixed a bug where
<audio controls />
and<video controls />
elements withouttabindex
attribute specified would be deemed NOT tabbable in Chrome, but would be in FireFox, because Chrome hastabIndex
(the DOM Element property) returning -1 (focusable, but not tabbable), while FireFox hastabIndex
returning 0 (focusable, and tabbable), yet both browsers include these elements in the regular tab order (as iftabIndex
was 0 for both browsers). Now these elements are considered tabbable in Chrome too! - Add any
<summary>
element directly under a<details>
element as tabbable and focusable. - BREAKING: Changes to the
isTabbableRadio()
internal function in order to better support nested radio buttons:- In case a form parent element exists, include only nested radio inputs from that form.
- Ignore checked radio elements from forms different from the one the validated node belongs to.
- NOTE: This may result in less radio elements being flagged as tabbable depending on context from the "root" node given to
tabbable()
.
- BREAKING: The exports have changed to be all named, and separate, as follows in order to help make the module more compatible with tree shaking:
tabbable
-> `import { tabbable } from 'tabbable';tabbable.isTabbable
-> `import { isTabbable } from 'tabbable';tabbable.isFocusable
-> `import { isFocusable } from 'tabbable';
- Also to help with tree shaking,
package.json
now statessideEffects: false
to mark this module as having no side effects as a result of merely importing it. - Added new UMD build, see
./dist/index.umd.*
.
- Improve performance by changing the method for detecting whether a DOM node is focusable or not. It's expected that this change will not affect results; but this is a major version bump as a warning for you to check your edge cases before upgrading.
- Fix reference to root element that caused errors within Shadow DOM.
- Allow module to be imported by non-browser JavaScript.
- Add
tabbable.isFocusable
andtabbable.isTabbable
functions.
- Add
[contenteditable]
elements.
- Add
<audio>
and<video>
elements withcontrols
attributes. - Only consider radio buttons tabbable if they are the
checked
on in their group, or if none in their group arechecked
.
- Fix bug causing SVG elements to precede elements they should follow in the tab order in IE.
- Ensure
querySelectorAll
receives a string argument.
- Fix crash when you call
tabbable(document)
(passing thedocument
element).
- Add
includeContainer
option.
- Allows operation against elements that reside within iframes, by inspecting the element to determine its correct parent
document
(rather than relying on the globaldocument
object).
- Ensure stable sort of
tabindex
ed elements even in browsers that have an unstableArray.prototype.sort
.
- Check
tabindex
attribute (viagetAttribute
), in addition tonode.tabIndex
, to fix handling of SVGs withtabindex="-1"
in IE.
- Children of
visibility: hidden
elements that themselves havevisibility: visible
are considered tabbable.
- Fix IE9 compatibility.
- Further improvements to caching.
- Fix overaggressive caching that would prevent
tabbable
from knowing an element's children had changed.
- Fix handling of
<a>
elements withtabindex="0"
.
- Initial release.