-
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
Should Confirmation Modals have cancel or confirm focused by default? #10040
Comments
Perhaps another reason to focus confirm is that it was most likely the users intention, and defaulting the focus to confirm reduces the number of actions required for it to take place. |
Default will be cancel for destructive actions |
++ |
To clarify, the default focus will be cancel, so by default hitting enter will be the same as clicking cancel. But this should be configurable, so that Enter can be made to confirm by default, and the intention is that its use is limited to non-destructive actions. |
Why have a default at all? Why not force to explicitly state what the default is? We want ppl to pay attention to these small yet important details. It it's explicit and someone gets it wrong we can pick it up in code review (with a side effect of spreading the knowledge as well) |
What @uboness is describing is what I had originally in mind, but I can see how the term "default" could have been interpreted to mean a default setting in the implementation. From a design perspective, we should err on the side of caution and explicitly set the default focus to be on the non-destructive option. If we decide that we can help the user complete an action more quickly by changing the default to be another option, e.g. a constructive action such as "Submit", then we can explicitly set the default focus to that option. I think Uri's points are on the mark, and we should avoid a default in the implementation, and instead require engineers to specify which option gains focus by default. |
No default is fine too, as long as it's configurable. Having a default means a little less typing, but as you point out, at the cost of being explicit. |
Addressed in EUI |
Per #9984 (comment) let's explore whether it's better to autofocus the cancel or confirm options when opening a Confirmation Modal.
Reasons to focus Cancel
It's the safe option. Since the Modal is there to prevent an irreversible action from being taken by accident, we should require explicit confirmation.
Reasons to focus Confirm
This is the way native browser confirmation modals behave.
The text was updated successfully, but these errors were encountered: