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

Modal: Auto Focus #1615

Open
1 task done
misael86 opened this issue Sep 25, 2024 · 0 comments
Open
1 task done

Modal: Auto Focus #1615

misael86 opened this issue Sep 25, 2024 · 0 comments
Labels
Comp: Modal Type: A11y Accessibility ally

Comments

@misael86
Copy link
Contributor

Does the component already exist

  • I confirm that I have checked if the component already exists in any of the Green libraries

For which framework/library you are requesting the component

React

Description

Once a modal is open the focus should be on the modal, so the first tab after opening a modal should be within the modal, most probably on the close button since that is the first interactable element inside of the modal?

When tabbing inside of a modal, it should not be possible to tab outside of the modal. One option is to set the tabindex of all other interactable elements to -1, but since this is quite tedious, we would want to propose that we listen to the tab and shift-tab events on the close buttons, both the one on the header and the footer. And once tabbing from the bottom close button, to prevent the default action and set focus on the close button on the header. And the other way around when shift-tabbing on the close button on the header. But feel free to find other solutions.

The last request is to be able to send an element to the modal so that when the modal is closed, the focus is set back to the button that opened the modal. So that you don't need to tab through the entire page again to return to where you left off.

Who will benefit from this feature?

Everyone using tabbing to navigate, and all teams using the modal component so that they don't need to find a solution to the problem by themselves.

Anything else?

Tested in https://storybook.seb.io/latest/react/?path=/story/components-modal--slide-out-small&args=isOpen:!false

@EldRoos EldRoos changed the title Better accessibility in modals Modal: Better accessibility Sep 26, 2024
@EldRoos EldRoos added Type: A11y Accessibility ally Comp: Modal labels Sep 26, 2024
@EldRoos EldRoos changed the title Modal: Better accessibility Modal: Auto Focus Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Comp: Modal Type: A11y Accessibility ally
Projects
None yet
Development

No branches or pull requests

2 participants