Skip to content

Disable focus trap & disable tab trap - #876

Open
bvellacott wants to merge 6 commits into
reactjs:masterfrom
bvellacott:disableFocusTrap-&-disableTabTrap
Open

bvellacott wants to merge 6 commits into
reactjs:masterfrom
bvellacott:disableFocusTrap-&-disableTabTrap

Conversation

@bvellacott

@bvellacott bvellacott commented May 21, 2021 •

Copy link
Copy Markdown

Fixes #[issue number].

Changes proposed:

  • add ability to disableFocusTrap
  • add ability to disableTabTrap

Acceptance Checklist:

  • The commit message follows the guidelines in CONTRIBUTING.md.
  • Documentation (README.md) and examples have been updated as needed.
  • If this is a code change, a spec testing the functionality has been added.
  • If the commit message has [changed] or [removed], there is an upgrade path above.

@coveralls

coveralls commented May 21, 2021 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 84.777% when pulling afada57 on bvellacott:disableFocusTrap-&-disableTabTrap into 827796d on reactjs:master.

@bvellacott

Copy link
Copy Markdown
Author

#799

Comment thread src/helpers/bodyTrap.js
if (instances.length > 0) {
const trapFocus = instances.find(({ props }) => !props.disableFocusTrap);

if (trapFocus && instances.length > 0) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we open one modal with focus trap disabled and one that's enabled?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then a focus trap will exist. I thought that is the best way to do it as it gives existing functionality priority over the added functionality. I could add something in the readme to let the user know?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment in the readme about this

Comment thread src/components/ModalPortal.js Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants