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

Shouldn't close on Esc #62

Closed
heruan opened this issue Oct 11, 2018 · 5 comments
Closed

Shouldn't close on Esc #62

heruan opened this issue Oct 11, 2018 · 5 comments
Assignees

Comments

@heruan
Copy link
Member

heruan commented Oct 11, 2018

Despite having set no-close-on-esc in the wrapped vaadin-dialog, pressing Esc closes the dialog.

@jouni
Copy link
Member

jouni commented Oct 24, 2018

I’m trying to guess here, but I assume you are perhaps misusing a confirm dialog for some other purpose? 😃

A standard confirm dialog should always be closable with the Esc key, so this issue could be considered “invalid”. But since it should be straightforward to let you do this (just bind the property), it should be alright to fix.

@heruan
Copy link
Member Author

heruan commented Oct 24, 2018

I won't say if your guess is correct or not 😈

But let's consider a proper confirm dialog, which is cancelable and rejectable: I would consider pressing Esc the same as pressing the button "Cancel", but if the dialog isn't cancelable it means I require an explicit choice: "Confirm" or "Reject", therefore in this case it must not close on pressing Esc.

@jouni
Copy link
Member

jouni commented Oct 26, 2018

Hmm, true, I skipped that for some reason completely. It seems we’ve skipped that use case completely in our initial design. Thanks for pointing it out 👍

Would you have a good example of this kind of dialog?

@heruan
Copy link
Member Author

heruan commented Oct 27, 2018

The user initiates a transactional processing on the server, which encounters some kind of issue producing the result and needs a user confirmation to be able to proceed or not: the user is prompted with a confirm dialog which asks if the action should be committed or rolled-back, no other choices permitted.

@tulioag tulioag self-assigned this Nov 21, 2018
@heruan
Copy link
Member Author

heruan commented Nov 21, 2018

To wrap it up (in my opinion, obviously):

  • it should be possible to enable/disable "close on ESC" with an attribute (like in vaadin-dialog), whether or not the dialog is cancelable;

  • when the dialog is closed by pressing ESC, a cancel event should be dispatched (as when pressing the "Cancel" button).

This way we can have a dialog which permits to cancel by pressing ESC, but also can force the user to explicitly press the "Cancel" button to close the dialog wihtout any choice; plus, the dialog can force the user to "Accept" or "Reject", as described by the discussed scenarios.

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

3 participants