@davidevmod/focus-trap@1.0.0
Major Changes
c4c8696
Thanks @DaviDevMod! - Bump to v1.0
Patch Changes
-
2c17880
Thanks @DaviDevMod! - Remove possibility to provideescape
as a function.It is unnecessary, as the user of the library can easily listen for
Esc
key presses by themselves.As a side note, the implementation of the previous behaviour was buggy.
-
d95f7df
Thanks @DaviDevMod! - Fix logic to "normalise"returnFocus
in normalise.tsThe default
document.activeElement
was not given in casereturnFocus
wasundefined
or a string not corresponding to any ID in the DOM.
It was given only whenreturnFocus === true
. -
fd6cf73
Thanks @DaviDevMod! - Fix algorithm to find a destination for the focus.When (during in the context of a Tab key press happening)
event.target
has a tab index of zero, the library should switch from looking for the next zero tabbable to look for a positive tabbable wheneverevent.target
is or precedes/follows the first/last zero tabbable in the whole focus trap.Before the fix, the switch in search would have happened only if
event.target
was contained in or preceded/followed the first/last root in the focus-trap. -
2c5bd1c
Thanks @DaviDevMod! - Remove custom type annotation forArray.prototype.findLast
.It is now buit-in since TypeScript v5.0 (microsoft/TypeScript#48829 (comment)).
-
0d154e8
Thanks @DaviDevMod! - Fixdemolish
logic in trap-actions.tsstate.isBuilt
was set tofalse
before callingpause
and the focus trap was therefore left up and running (while an error would be thrown, saying "Cannot pause inexistent trap" ). -
0d90cba
Thanks @DaviDevMod! - Export types -
79b0e44
Thanks @DaviDevMod! - Fix inefficient code in destination.ts