The motion of the Escape key on a modal dialog is obvious in that it closes the dialog, successfully clicking a ‘Cancel’ button or related.
Nonetheless, what’s the present consensus of the Enter key whereas in a modal dialog and never centered on a button?
Within the pattern modal above, from HTML kinds one would possibly count on a dialog’s contents (if any) to be submitted as if the person has clicked the ‘Save’ button.
Nonetheless, the modal may also be a affirmation to delete, modify, approve, unattach one thing, and so forth. It could additionally include non-form information manipulation, extra akin to a modal window than dialog. Consistency would then recommend that Enter continues to carry out the first motion in different dialogs, even with out kind content material. However this then goes towards my intuition of defaulting to a protected motion, and the well-established precept of creating it clear what motion modal buttons will carry out.
It will be all too straightforward for a person to unintentionally hit Enter (the bottom-right of many keyboards) and carry out an motion which may trigger a change that’s tough or irritating to undo.
With the above points, it looks as if it might be simpler to not enable any motion on the Enter key in any respect until a button is concentrated. To stability this with speedy keyboard navigation, maybe specializing in the ‘Cancel’ button first is perhaps greatest, permitting a tab to the first (unsafe) motion button. Tab-Enter appears an affordable compromise for security.