Socket
Socket
Sign inDemoInstall

focus-trap

Package Overview
Dependencies
Maintainers
3
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

focus-trap - npm Package Versions

1
9

6.7.1

Diff

Changelog

Source

6.7.1

Patch Changes

  • 28a069f: Fix bug from #504 where it's no longer possible to create a trap without any options [#525]
stefcameron
published 6.7.0 •

Changelog

Source

6.7.0

Minor Changes

  • 893dd2c: Add document option to support focus traps inside <iframe> elements (#97)
  • 244f0c1: Extend the setReturnFocus option to receive a reference to the element that had focus prior to the trap being activated when a function is specified. Additionally, the function can now return false to leave focus where it is at the time of deactivation. (#485)

Patch Changes

  • 60162eb: Fix bug where KeyboardEvent was not being passed to escapeDeactivates option when it's a function (#498)
  • 7b6abfa: Fix how focus-trap determines the event's target, which was preventing traps inside open shadow DOMs from working properly (#496)
  • 14b0ee8: Fix initialFocus option not supporting function returning false as documented (#490)
stefcameron
published 6.6.1 •

Changelog

Source

6.6.1

Patch Changes

  • 24063d7: Update tabbable to v5.2.1 to get bug fix for disabled fieldsets.
stefcameron
published 6.6.0 •

Changelog

Source

6.6.0

Minor Changes

  • 281e66c: Add option to allow no initial focus when trap activates via initialFocus: false

    There may be cases where we don't want to focus the first tabbable element when a focus trap activates.

    Examples use-cases:

    • Modals/dialogs
    • On mobile devices where "tabbing" doesn't make sense without a connected Bluetooth keyboard

    In addition, this change ensures that any element inside the trap manually focused outside of focus-trap code will be brought back in focus if focus is somehow found outside of the trap.

    Example usage:

    When the trap activates, there will be no initially focused element inside the new trap.

    const focusTrap = createFocusTrap('#some-container', {
      initialFocus: false,
    });
    
  • 75be463: escapeDeactivates can now be either a boolean (as before) or a function that takes an event and returns a boolean.

Patch Changes

  • e2294f0: Fix race condition when activating a second trap where initial focus in the second trap may be thwarted because pausing of first trap clears the delayInitialFocus timer created for the second trap before during its activation sequence.
stefcameron
published 6.5.1 •

Changelog

Source

6.5.1

Patch Changes

  • c38bf3f: onPostDeactivate should always be called even if returnFocus/OnDeactivate is disabled.
stefcameron
published 6.5.0 •

Changelog

Source

6.5.0

Minor Changes

  • 278e77e: Adding 4 new configuration event options to improve support for animated dialogs and animated focus trap triggers: checkCanFocusTrap(), onPostActivate(), checkCanReturnFocus(), and onPostDeactivate().

Patch Changes

  • 8d11e15: Improve docs and types for most options, adding SVGElement as a supported type of "DOM node" since it supports the focus() method, same as HTMLElement.
stefcameron
published 6.4.0 •

Changelog

Source

6.4.0

Minor Changes

  • 21c82ce: Bump tabbable from 5.1.6 to 5.2.0. There should be no changes in behavior as a result of this upgrade as focus-trap does not currently leverage the new displayCheck option.

Patch Changes

  • 1baf62e: Fix focus trapped on initial focus container with tabindex=-1 when pressing shift+tab (#363)
stefcameron
published 6.3.0 •

Changelog

Source

6.3.0

Minor Changes

  • a882d62: clickOutsideDeactivates can now also be a function that returns a boolean, similar to allowOutsideClick. The function receives the MouseEvent that triggered the click. (#289)

Patch Changes

  • 4d67dee: Fix a focus escape when pressing TAB after hiding element with focus (#281)
  • ca32014: Bump tabbable from 5.1.4 to 5.1.5
stefcameron
published 6.2.3 •

Changelog

Source

6.2.3

Patch Changes

  • 036a72e: Fix crash in IE due to use of Array.findIndex() not supported in that browser (#257)
stefcameron
published 6.2.2 •

Changelog

Source

6.2.2

Patch Changes

  • fd3f2d1: Fix a bug where a multi-container trap would cease to work if all tabbable nodes were removed from one of the containers (fixes #223). As a result, an error is now thrown if the trap is left in a state where none of its containers contain any tabbable nodes (unless a fallbackFocus node has been configured in the trap's options). Also, the most-recently-focused node is more reliably tracked now, should focus somehow escape the trap and be brought back in by the trap, resulting in the truly most-recently-focused node to regain focus if that ever happens.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc