-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dialog, modal, popover, sheet): add options prop to customize fo…
…cus-trap (#11453) **Related Issue:** #11345 ## Summary Adds `focusTrapOptions` option to allow additional customization of focus-trapping components. It supports the following options from https://github.com/focus-trap/focus-trap#createoptions: * `initialFocus` – would replace popover's internal initialFocusTrapFocus prop * `allowOutsideClick` – supports #10682 * `returnFocusOnDeactivate` – supports #10682 And the following custom prop: * `extraContainers` – allows specifying extra elements (nodes or selectors) to focus trap (e.g., anything appending to the body, etc) when creating/activating the trap. **Note**: if specified, elements must exist when the focus trap is activated, if extra containers are created afterwards, users can use `updateFocusTrapElements(extraContainers)` This also enhances `updatesFocusTrapElements()` to accept extra containers to allow in the focus trap if these are created after the trap is activated. ### Notes * A subset of https://github.com/focus-trap/focus-trap#createoptions options are exposed as certain configurations might break component functionality. * `extraContainers` gets used both when creating and updating the focus trap target containers * Tidies up types
- Loading branch information
Showing
6 changed files
with
175 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.