focus-trap
Advanced tools
Changelog
6.1.0
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).Changelog
6.0.1
Changelog
6.0.0
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.*
.Changelog
5.1.0
setReturnFocus
option that allows you to set which element receives focus when the trap closes.Changelog
5.0.2
allowOutsideClick
option that allows you to pass a click event through, even when clickOutsideDeactivates
is false
.Changelog
5.0.0
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
).Changelog
4.0.2
(Release 4.0.1 was a mistake, containing no changes.)
Changelog
4.0.0