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

Accessibility - using the ESC key while keyboard focus is on the toaster should close the toaster for all types #260

Open
ahayes91 opened this issue May 19, 2020 · 2 comments

Comments

@ahayes91
Copy link

From the docs, I saw that the "confirm" type of toaster message caters for closing the toaster on ESC:

Toastr: confirm
The confirm method takes two arguments. The first one is the message and the second one is an object where you can specify what will happen when the user clicks on ok or on the cancel buttons or on keypress enter/esc.

Ideally this should be an option for all types of toasters - when focus is on the toaster, you should be able to use the ESC key to close it, as per accessibility standards for modal dialogs: https://bitsofco.de/accessible-modal-dialog/

@ahayes91
Copy link
Author

Looks like I could do something similar to this #244 (comment) and just add an ESC key handler to the X button - in my case that's enough, because the only focusable element in our toaster is the X button. However, it is still worth fixing properly with a prop in case other focusable elements are included in the toaster for any reason.

@diegoddox
Copy link
Owner

Hi @ahayes91 thanks for the link, I will take a look on it.

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