-
Notifications
You must be signed in to change notification settings - Fork 344
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
Default actions on modal dialogs via ENTER key #2992
Comments
The ARIA Authoring Practices (APG) Task Force just discussed The full IRC log of that discussion<jugglinmike> Subtopic: Default actions on modal dialogs via ENTER key<jugglinmike> github: https://github.com//issues/2992 <jugglinmike> Jem: This person is asking to use the "enter" key for escaping the modal dialog <jugglinmike> Matt_King: They want to know if we can take the list of default actions in the modal dialog, should we say something about the enter key performing the default action <jugglinmike> Jem: What is the default action? <jugglinmike> jongund: Typically, it's the "submit" <jugglinmike> Matt_King: I'm personally nervous about pressing "enter" in these situations because I'm not confident what it will do <jugglinmike> Matt_King: ARIA doesn't have anything related to "default action" <jugglinmike> Jem: "Enter key for default action" is a clear scope. But it's not clear what the default action is <jugglinmike> CoryJoseph: I never use the default action in a modal, either <Jem> s/Enter key for default action/Enter key for submit action <jugglinmike> Matt_King: I think this is why ARIA doesn't include a default action attribute that you can apply to dialogs <Jem> s/Enter key for default action/Enter key for submit action/ <jugglinmike> Matt_King: because there's no way of communicating the default action in a web dialog to an end user <jugglinmike> Matt_King: That's why I feel a little reluctant to say anything at all about default actions in the interactions section of the modal dialog <jugglinmike> jongund: Well, it's a browser convention <jugglinmike> jongund: You get default action, it looks for the submit button <jugglinmike> jongund: If you're in a form, that is <jugglinmike> jongund: What does ARIA say about default actions? That you should do it? That you shouldn't do it? That sometimes you should do it? <jugglinmike> jongund: Maybe this is beyond the scope of ARIA. It might not be worth saying anything about it in APG <jugglinmike> Matt_King: If we said something about it, that would suggest that there is a way to define a default action for a dialog <jugglinmike> CoryJoseph: Escape closes the dialog <jugglinmike> Matt_King: That's not a default behavior, though <jugglinmike> CoryJoseph: No, it's just a user expectation <Jem> Enter key for default action <jugglinmike> Jem: I searched the ARIA spec, and there's nothing about default in 1.3. In 1.2, however, there's a comment about it in a note <jugglinmike> [Jem reads the notes] <jugglinmike> s/notes/note/ <jugglinmike> Matt_King: That is the way that screen readers emulate a mouse click in "reading" mode. It's not related to the default action which we're considering here <jugglinmike> CoryJoseph: If there's a form inside the modal, and you have a submit button, then there's a default action <jugglinmike> CoryJoseph: Otherwise, there is no default action <jugglinmike> Matt_King: Does a screen reader ever tell you about the default action in a form...? <jugglinmike> CoryJoseph: I don't think so, not even with the most generous hints on <jugglinmike> dmontalvo: I think you can get at the default on a Windows desktop app <jugglinmike> Matt_King: Sure, in a dialog you can <jugglinmike> dmontalvo: That may be out of scope for this discussion, though <jugglinmike> Jem: I think we're saying "no", and the uncertainty here is the reason <jugglinmike> Matt_King: Because ARIA does not provide a way of communicating what the default action will be, for us to say how to perform a default action is going beyond the spec. <Jem> https://github.com/w3c/aria/issues/2165 <jugglinmike> Zakim, end the meeting |
Apart from personal preferences and uses the default action is commonly used in native operating system dialogs, for decades. IBM System Application Architecture, Common User Access, SC26-4582-0, first edition from June 1989, Chapter 7 Dialog Boxes, on page 98: "When you display several pushbuttons in the same dialog box, identify one of them as the default action by using a bold border. When users move the selection cursor [focus] between pushbuttons, the bold border moves with the cursor. The bold border usually appears on the action that lets users respond positively to the dialog, for example, on the OK action. However, when the dialog box supports a destructive action, such as Delete, the default should be Cancel. Users therefore, have to explicitly change the selection from Cancel in order to perform the destructive action." In the same document, Appendix B. Keyboard and Mouse Assignments, on page 148 under "Navigation Key Assignments" the ENTER key is described as "Submits the dialog for processing of the default action". The design idiom has also been added to the Windows styleguides. "Use the ENTER key for the default action of a dialog box, if available. The Windows 98 style guide also had a section about "Default Buttons" but I was unable to retrieve this. However, I was implementing dialogs start of the 1990s (in OS2 Presentation Manager, Unix Motif and later on Microsoft Windows) when mapping the ENTER key to the default action was a key task to implement dialogs. Best regards, Oliver. |
The Windows API (WIN32) has a control style named "BS_DEFPUSHBUTTON" which allows programmers to explicitly set the default button, so tools can retrieve the default button type. Technically this can be retrieved via the GetWindowLong API. |
Addendum: ISO 9241 (Software Usability), 143 (Form-based dialogs), chapter 4.16 - "Default Actions for forms elements". The ISO norm provides additional hints on implementing great working default actions on dialogs. ISO 9241-171 (Accessibility): 9.3.15 Follow platform keyboard conventions |
In addition, the ARIA-APG should give hints how existing aria properties can be used to fill the gap of useful properties ARIA spec hasn't declared yet. In my opinion, using aria-description to describe a button as "Default" is one of the things that belongs in a best practices guideline. |
Many modal dialogs provide a default action. This action is some kind of commit action to proceed. Other than the ESC key, which in most cases cancels a dialog so changes are rolled back, the ENTER key triggers a commit action which then actually closes the dialog and transfers data changes (commits) to the hosting application.
Common keyboard use is:
a) the user moves focus to the button which represents the commit action, like "OK", "Continue", "Save". Then the user uses role-specific keyboard commands to trigger the focused UI element. For a button either SPACE or ENTER are commonly used.
b) If the focus is on some UI elements / components, which do not locally consume the ENTER key, such as input fields, the ENTER key can used as trigger for the default action, so the commit action is activated although the according UI element (a button) is not focused. So b) represents a great efficiency option for keyboard-only users.
Wouldn't it be an option to also list the use of the ENTER key as a trigger for modal dialog's default actions?
It could give guidance to modal dialog developers about the common use of modal dialogs as these are used in native operating systems, such as Windows, Linux or macOS.
I am referring to the following page: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
regards, Oliver.
The text was updated successfully, but these errors were encountered: