focus-trap-react
Advanced tools
Changelog
8.3.0
<FocusTrap />
when containerElements
is used. The child was already being ignored anyway (when containerElements
is used; if the prop is not used, then a single child is still required).children
prop to make it optional. Prop-types already had children
as optional, however the use of React.Children.only()
in all cases was still forcing the presence of a single child. That's no longer the case.containerElements
prop in the documentation.Changelog
8.2.0
Changelog
8.1.1
^16.0.0
to >=16.0.0
since this library works with React 17 as well as React 16.active
prop to false
. #139Changelog
8.1.0
delayInitialFocus
flag that can be used to further customize trap behavior.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
8.0.0
Changelog
7.0.0
<FocusTrap>
.focus-trap
dependency from 4.0.2 to 5.1.0 for the latest features/fixes it provides. #71children
's type is React.ReactNode
, not React.ReactElement
. #66specifiedFocusTrapOptions.includes(optionName)
statement in componentDidMount()
was causing an exception because includes()
is not a function defined on Object
.Changelog
6.0.0
Changelog
5.0.0
<FocusTrap>
now expects exactly one child element which can be any HTML element or other React component that contains focusable elements. The tag
prop has been removed, as has support for additional props that are passed through to the tag
, because it is no longer necessary: you should provide your own element, with whatever props you want, as a child of <FocusTrap>
.