Skip to content

@davidevmod/focus-trap@1.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 26 May 15:51
· 420 commits to main since this release
9d1800a

Major Changes

Patch Changes

  • 2c17880 Thanks @DaviDevMod! - Remove possibility to provide escape 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.ts

    The default document.activeElement was not given in case returnFocus was undefined or a string not corresponding to any ID in the DOM.
    It was given only when returnFocus === 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 whenever event.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 for Array.prototype.findLast.

    It is now buit-in since TypeScript v5.0 (microsoft/TypeScript#48829 (comment)).

  • 0d154e8 Thanks @DaviDevMod! - Fix demolish logic in trap-actions.ts

    state.isBuilt was set to false before calling pause 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