Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork27
Description
First of all, wonderful set of components! Thank you for creating these.
There is an issue with the Modal component. Let's say we have a button that opens a Modal (e.g. «Open ConfirmationModal» button in your Modaldocumentation page). If the user uses keyboard / tab to move focus to that button, the user then can keep pressing «space» and it would keep opening new Modals.
Modals in general should save the last focused element, and then use a focus trap to prevent users from changing focus. In order to create a Focus Trap, you can simply bracket the dialog node with two invisible, focusable nodes (<div tablindex="0" />). While this dialog is open, we use these to make sure that focus never leaves the document even if dialogNode is the first or last node.