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

Allowing user to press ESC to exit modal window. #512

Open
davem7714 opened this issue Mar 30, 2023 · 3 comments
Open

Allowing user to press ESC to exit modal window. #512

davem7714 opened this issue Mar 30, 2023 · 3 comments
Labels
Feature Request Request to add a new feature Up For Grabs This issue is available to anyone that wants to help

Comments

@davem7714
Copy link

It would really be nice if instead of the user having to click the "X" or somewhere outside of the window to close it. If we could trap the user pressing the ESC key and then execute the onclick of a button in the modal or just call the method that will close the form with a "cancel" that would be great.

@davem7714 davem7714 added Feature Request Request to add a new feature Triage Issue needs to be triaged labels Mar 30, 2023
@emilg
Copy link

emilg commented Apr 5, 2023

+1, this would of course have been preferable as default behavior.

What you can do is programmatically listen for whether ESC is pressed and whether the modal is open. -> https://blazored.github.io/Modal/usage/closing-programmatically

@davem7714
Copy link
Author

I understand how to close the modal programmatically but I'm not clear how to listen for the ESC key being pressed. Any links that discuss this would be helpful. I'll start researching. Thanks!

@NeskireDK
Copy link

I too have yet to find a nice way to listen for ESC key, and close ANY modal open.
I know there was an attempt to make ESC work for closing, but was later removed due to conflict.

@chrissainty chrissainty added Up For Grabs This issue is available to anyone that wants to help and removed Triage Issue needs to be triaged labels Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Request to add a new feature Up For Grabs This issue is available to anyone that wants to help
Projects
None yet
Development

No branches or pull requests

4 participants