NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #4193 most downloaded on npm
Trap focus within a DOM node.
Last release today
04 Oct 2026
Release timing varies
gaps range from 9 days to 5 months
Nearly every release is documented
notes for 59 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
97 releases · first in 2015
00674dd: Fix #172: Transpile non-minified bundles so they are compatible with IE11.
fe2b0ad: Fixed #103: returnFocusOnDeactivate is now respected on auto-deactivation with clickOutsideDeactivates=true.
returnFocusOnDeactivate is now respected on auto-deactivation with clickOutsideDeactivates=true.One column per quarter.
5174ce1: Add delayInitialFocus option
prepublishOnly script to prepare script so that it also runs if someone installs the package directly from the git repo (e.g. from your work in which you fixed a bug or added a feature you're waiting to get merged to master and published to NPM).isHidden() -> isNodeAttached() -> getRootNode() if not handled properly (focus-trap-react #905)694e2fa: Package main/module entries no longer point to minified bundles.
BREAKING: Updated tabbable dependency to the new 5.0.0 release which contains breaking changes to its isTabbableRadio() internal function.
allowOutsideClick option.preventScroll feature to prevent scrolling to the element getting focus if not in the viewport.isTabbableRadio() internal function.package.json state sideEffects: false to mark this module as having no side effects as a result of merely importing it.package.json's "main" no longer points to ./index.js in the package (although it still points to a CJS module, so it's possible this actually doesn't break anything). It now has:
dist/focus-trap.min.js (the CJS bundle)dist/focus-trap.esm.min.js (the new ESM bundle)dist/focus-trap.umd.min.js if needed (convenient for loading directly in an older browser that doesn't support ESM)const { createFocusTrap } = require('focus-trap'); to get the function from before.import { createFocusTrap } from 'focus-trap'; to import the module.dist/focus-trap.esm.*.dist/focus-trap.umd.*.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.Add setReturnFocus option that allows you to set which element receives focus when the trap closes.
setReturnFocus option that allows you to set which element receives focus when the trap closes.focusable() for getting all focusable nodes.tabbable has been fixed: Was Array<Element> (an Element is technically not focusable), is now Array<HTMLElement | SVGElement> (which are both still/also Element instances).position: fixed) containers should now be consistently found in supported browsers.prepublishOnly script with prepare 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.focusable() type definition.#__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 as package.json#module to avoid dropping the comments (including existing #__PURE__ annotations).Add allowOutsideClick option that allows you to pass a click event through, even when clickOutsideDeactivates is false.
allowOutsideClick option that allows you to pass a click event through, even when clickOutsideDeactivates is false.Nothing published for this version
Update Tabbable to improve performance (see Tabbable's changelog).
onActivate callback changes the list of tabbable nodes and the initialFocus option is not used, the initial focus will still go to the first element present before the callback.passive: false).<audio controls /> and <video controls /> elements without tabindex attribute specified would be deemed NOT tabbable in Chrome, but would be in FireFox, because Chrome has tabIndex (the DOM Element property) returning -1 (focusable, but not tabbable), while FireFox has tabIndex returning 0 (focusable, and tabbable), yet both browsers include these elements in the regular tab order (as if tabIndex was 0 for both browsers). Now these elements are considered tabbable in Chrome too!<summary> element directly under a <details> element as tabbable and focusable.isTabbableRadio() internal function in order to better support nested radio buttons:
tabbable().tabbable -> `import { tabbable } from 'tabbable';tabbable.isTabbable -> `import { isTabbable } from 'tabbable';tabbable.isFocusable -> `import { isFocusable } from 'tabbable';package.json now states sideEffects: false to mark this module as having no side effects as a result of merely importing it../dist/index.umd.*.Fix reference to root element that caused errors within Shadow DOM.
(Release 4.0.1 was a mistake, containing no changes.)
Nothing published for this version
Breaking (kind of): Focus trap now manages a queue of traps, so when a trap is paused because another trap activates, it will be unpaused when that ot
Breaking (kind of): Update Tabbable to detect more elements and be more careful with radio buttons (see Tabbable's changelog).
clickOutsideDeactivates and returnFocusOnDeactivate are both true, focus will be returned to the pre-trap element only if the clicked element is not focusable.Add slight delay before moving focus to the first element in the trap. This should prevent an occasional bug caused when the first element in the trap
Fix "main" field in package.json.
"main" field in package.json.Publish UMD build so people can download it from unpkg.com.
unpkg.com.Fixed: TypeScript signature for activate function.
activate function.Added: TypeScript declaration file.
Nothing published for this version
Nothing published for this version
Fixed: Activation does not re-focus already-focused node.
tabindex and is in the middle of other tabbable elements.Added: initialFocus and fallbackFocus options can take functions that return DOM nodes.
initialFocus and fallbackFocus options can take functions that return DOM nodes.pause and unpause cannot accidentally add extra event listeners.Added/fixed, depending on your perspective: If focus is already inside the focus trap when it is activated, leave focus where it is instead of forcing
initialFocus.- Added: fallbackFocus option.
fallbackFocus option.Fixed: clickOutsideDeactivates no longer triggers deactivation when you click _inside_ the trap.
clickOutsideDeactivates no longer triggers deactivation when you click inside the trap.Fix bug when activating multiple focus traps.
Rewrote the thing, altering the API. Read the new docs please.
tabbable to fix handling of traps with changing contents.<audio> and <video> elements with controls attributes.checked on in their group, or if none in their group are checked.Improve clickOutsideDeactivates functionality.
clickOutsideDeactivates functionality.tabbable(document) (passing the document element).Add clickOutsideDeactivates option.
clickOutsideDeactivates option.escapeDeactivates option.Make sure to select() elements when they receive focus via tab.
select() <input> elements when they receive focus via tab.tabbable from knowing an element's children had changed.Fix buggy attempts to focus nodes that don't exist.
- Initial release.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →