Skip to content

Releases: focus-trap/focus-trap

v8.0.0

28 Jan 17:24
d9155b4

Choose a tag to compare

Major Changes

  • b6ea4b5: Breaking: Fixed a long-standing bug where onPostActivate() would be called before the initial focus node was focused and the trap was fully activated. (#1747)
    • By default (and for many years now), a trap delays setting focus to the initial focus node to the next frame (setTimeout(0)) but wasn't delaying calling onPostActivate() until after that delay.
    • With the new isolateSubtrees='aria-hidden' option, the currently-focused node's container (a non-subtree being "disabled") would get hidden before the delay was up, resulting in Chrome preventing the effect of aria-hidden on that subtree with a warning in the console due to the container being hidden still containing focus (e.g. the "activate trap" button).
    • With the fix, subtree isolation and the call to onPostActivate() await the initial focus delay (if there is one, which is default behavior; remove it with delayInitialFocus=false) before being applied/called.
    • This may cause tests to fail, requiring the addition of slight delays before testing a given state (e.g. await waitFor(() => expect(initialFocusNode).toBeFocused()).
    • It may also disrupt current assumptions about the state of the initial focus node in code that runs in your onPostActivate() handler (prior to this change, that node would not be focused yet; after this change, it will be focused).

v7.8.0

10 Jan 22:24
b1751b6

Choose a tag to compare

Minor Changes

  • c214581: Adds aria-hidden support to isolateSubtrees config option

Patch Changes

  • bb36e15: Fix undefined method _setSubtreeIsolation crash when using trapStack in DOM with older versions of Focus-trap (#1729)

v7.7.1

31 Dec 17:54
4729d34

Choose a tag to compare

Patch Changes

  • a386578: Bump tabbable dependency for improved inert handling

v7.7.0

20 Dec 20:17
ece30cb

Choose a tag to compare

Minor Changes

  • 14b9155: Adds a new feature "isolateSubtrees", allowing focus-trap to prevent screen readers from reading content outside the trap. (#1575)

v7.6.6

26 Oct 23:51
ab97ac2

Choose a tag to compare

Patch Changes

  • dcd4ae9: Update tabbable dependency to 6.3.0 for new displayCheck option.

v7.6.5

27 May 20:55
260bf74

Choose a tag to compare

Patch Changes

  • d51ad78: Allow activation element in shadow DOM to be auto-focused after trap is deactivated

v7.6.4

10 Jan 20:00
bf904ca

Choose a tag to compare

Patch Changes

  • bb47f7a: Remove engine requirement that crept into package.json. Sorry about that! (#1343)

v7.6.3

10 Jan 18:32
1d36851

Choose a tag to compare

Patch Changes

  • 0a9b746: Prevent a previous focus trap that is manually paused from being automatically unpaused when the current trap is deactivated. Also prevent a paused trap that is not at the top of the stack from being unpaused.

v7.6.2

16 Nov 18:50
893ae5f

Choose a tag to compare

Patch Changes

v7.6.1

10 Nov 16:46
6c757fa

Choose a tag to compare

Patch Changes

  • fc5910d: Fix fallbackFocus not used when initialFocus is selector to non-existent node (#1218)