Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrapFocus on Modal for accessibility #981

Open
Subha opened this issue Oct 28, 2021 · 1 comment
Open

TrapFocus on Modal for accessibility #981

Subha opened this issue Oct 28, 2021 · 1 comment

Comments

@Subha
Copy link

Subha commented Oct 28, 2021

Describe the bug

We wanted to trap focus when the modal is opened. Focus should be retained in the modal after the last focused item.

To Reproduce

Steps to reproduce the behavior:

  1. https://react-bootstrap.github.io/react-overlays/api/Modal
  2. After the last focusable element in the modal the focus should not move outside.
  3. Tried with enforceFocus property as well.

Reproducible Example


https://react-bootstrap.github.io/react-overlays/api/Modal

Expected behavior

Maintain focus within the modal should not move to the Browser url
Accessibility Example: https://dequeuniversity.com/library/aria/simple-dialog

Screenshots

Screen Shot 2021-10-27 at 10 32 36 PM

Environment (please complete the following information)

  • Operating System: [macOS]
  • Browser, Version [Chrome 95]
  • react-overlays Version [5.1.1]

Additional context

This is a great library, appreciate if this can be fixed on the library or provide a work around. If this is already addressed and I am missing to add any properties please let me know.

@jquense
Copy link
Member

jquense commented Oct 28, 2021

This is intentional and inline with how native dialogs work. The focus is limited to the modal but can cycle out of the window. You can tab from the url bar and focus will be put back into the Modal. We e vetted this approach a number of times with a11y folks and it's been wildly 👍 as correct. This does deviate from many online examples but because we are doing more to implement this well not less

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

No branches or pull requests

2 participants