-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add escape key handling to ConfirmModal #10099
Comments
If there is no |
That's not how the native confirm dialog works. ESC is the same as cancel, because there is no close button. Confirm forces you to deal with the prompt. Our confirm should work the same as the native confirm. Please don't take my keyboard navigation away. |
I would like to take a stab at this as a first commit to the project. I've got working code already and just need to write tests. One thing I could use some feedback on: it is easy enough to implement the ng-keydown event when the modal is focused, but if the user clicks outside of the modal buttons it becomes unfocused and the ng-keydown will not trigger anymore. My suggestion would be, since the "Confirm" button starts out focused, call onCancel() in the ng-blur directive for the "Confirm" button. That way if the user clicks on the screen outside of the buttons, the dialog will close (I believe this is pretty standard for modal dialogs?). Feedback on this would be appreciated! |
Actually, I am realizing that my problem is that the ConfirmModal is passed as a child to the ModalOverlay, which does not have the ng-keydown directive. I am trying to figure out how to access the onKeyDown function of the ConfirmModal from the ModalOverlay, which I think will be the correct solution. |
Figured it out, but build is failing locally due to:
@tsullivan I notice you had the same error referenced in #9797 did you figure out a solution? |
Hey @dpenny52, sorry I haven't gotten back to you sooner, I've been falling behind on my github notifications. Thanks for putting together a PR, I'll dig into that shortly. |
No problem @w33ble thanks for getting back |
Now that we're using our own custom model for confirmations, we've lost some of the keyboard use of native confirmations. This is a regression from previous confirmation dialog functionality.
We already focus the confirm button by default, so the user can just hit enter to confirm (though, that could change, see #10040), which is great.
We are still missing mapping the ESC key to cancel. A lot of users don't click on dialogs (myself included), preferring to use the keyboard instead. We should restore this useful keyboard interaction.
The text was updated successfully, but these errors were encountered: