focus-trap
Advanced tools
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
Changelog
3.0.0
clickOutsideDeactivates
and returnFocusOnDeactivate
are both true
, focus will be returned to the pre-trap element only if the clicked element is not focusable.Changelog
2.4.6