focus-trap

Trap focus within a DOM node.

MIT License

Downloads
7M
Stars
1.3K
Committers
38

Bot releases are visible (Hide)

focus-trap - v6.8.0

Published by github-actions[bot] over 2 years ago

Minor Changes

  • 21458c9: Bumps tabbable to v5.3.0 and includes all changes from the past v6.8.0 beta releases. The big new feature is opt-in Shadow DOM support in tabbable, and a new getShadowRoot tabbable option exposed in a new tabbableOptions focus-trap config option.
focus-trap - v6.7.3

Published by github-actions[bot] over 2 years ago

Patch Changes

  • ab20d3d: Fix issue with focusing negative tabindex node and then tabbing away when this node is not the last node in the trap's container ((#611)[https://github.com/focus-trap/focus-trap/issues/611])
focus-trap - v6.7.2

Published by github-actions[bot] almost 3 years ago

Patch Changes

  • c932330: Fixed bug where tabbing forward from an element with negative tabindex that is last in the trap would result in focus remaining on that element (565)
focus-trap - v6.7.1

Published by github-actions[bot] about 3 years ago

Patch Changes

  • 28a069f: Fix bug from #504 where it's no longer possible to create a trap without any options [#525]
focus-trap - v6.7.0

Published by github-actions[bot] about 3 years ago

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)
focus-trap - v6.6.1

Published by github-actions[bot] about 3 years ago

Patch Changes

  • 24063d7: Update tabbable to v5.2.1 to get bug fix for disabled fieldsets.
focus-trap - v6.6.0

Published by github-actions[bot] over 3 years ago

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.
focus-trap - v6.5.1

Published by github-actions[bot] over 3 years ago

Patch Changes

  • c38bf3f: onPostDeactivate should always be called even if returnFocus/OnDeactivate is disabled.
focus-trap - v6.5.0

Published by github-actions[bot] over 3 years ago

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.
focus-trap - v6.4.0

Published by github-actions[bot] over 3 years ago

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)
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.3.0

Published by github-actions[bot] almost 4 years ago

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
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.2.3

Published by github-actions[bot] almost 4 years ago

Patch Changes

  • 036a72e: Fix crash in IE due to use of Array.findIndex() not supported in that browser (#257)
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.2.2

Published by github-actions[bot] almost 4 years ago

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.
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.2.1

Published by github-actions[bot] almost 4 years ago

Patch Changes

  • f0c2aff: Bump tabbable to 5.1.4 for bug fix.
  • 2ba512b:
    • Refactored code to use function declarations instead of hoisted functions (this should have no bearing on functionality in the build output included in ./dist.
    • Fixed bugs where trap.activate() and trap.deactivate() would not always return the trap (now they do in all circumstances).
  • d26d2e1: Refactoring to use const/let, and simplify a few lines. This does NOT impact the build output published in ./dist, however, and hence does not impact browser support.
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.2.0

Published by github-actions[bot] almost 4 years ago

Minor Changes

  • 2267d17: Adding support for multiple elements to be passed in #217
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.1.4

Published by github-actions[bot] almost 4 years ago

Patch Changes

  • 38b6b98: Update tabbable to 5.1.3 to get bug fixes related to detail and summary elements.
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.1.3

Published by github-actions[bot] about 4 years ago

Patch Changes

  • 6a39217: Close the gap with #172 and bump tabbable to 5.1.2 which has a similar fix.
  • 756c79d: Fix #172 (again): Transpile ESM bundle down to the same browser target used for the CJS and UMD bundles. ESM is just the module system, not the browser target.
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.1.2

Published by github-actions[bot] about 4 years ago

Patch Changes

  • 00674dd: Fix #172: Transpile non-minified bundles so they are compatible with IE11.
  • 679009b: Update tabbable dependency to 5.1.1 to get transpiled non-minified bundles.
focus-trap - https://github.com/focus-trap/focus-trap/releases/tag/v6.1.1

Published by github-actions[bot] about 4 years ago

Patch Changes

  • fe2b0ad: Fixed #103: returnFocusOnDeactivate is now respected on auto-deactivation with clickOutsideDeactivates=true.