Skip to content

Releases: focus-trap/focus-trap

v8.2.1

16 May 18:24
23b5ccf

Choose a tag to compare

Patch Changes

  • 7e0e518: Fixes lifecycle ordering bug introduced in v8.0.0 that always delays the order even if delayInitialFocus=false, delayReturnFocus=false, checkCanFocusTrap=undefined, checkCanReturnFocus=undefined (which would indicate a fully synchronous activation/pause/unpause/deactivation process) #1862
  • 2cba31e: Improve shadow DOM focus handling for nested traps by ensuring a parent trap resumes using the innermost active element (#1885)

v8.2.0

04 May 00:25
b0ce1ac

Choose a tag to compare

Minor Changes

  • 567dbe1: Add new delayReturnFocus option (default true) to control whether return focus and onPostDeactivate are deferred by one frame (#1689).

Patch Changes

  • b70e8d9: Fix bug where removing the ancestor of a focused node within a trap would result in focus landing on the body instead of remaining in the trap (#1660).

v8.1.0

24 Apr 14:34
bf5dbd4

Choose a tag to compare

Minor Changes

  • 642f7f2: Update lifecycle hooks to include the associated focus trap as a parameter.

v8.0.1

21 Mar 19:10
c2dfa70

Choose a tag to compare

Patch Changes

  • 7d5010e: Loosen checkCanFocusTrap Promise resolution type to unknown to make it easier to use Promise.all() or Promise.allSettled() as the returned Promise (Promise<void> was causing issues because those Promise APIs do not resolve with a void value).

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