You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enter key should be consistent for dialogues/modals? #3629
@tierninho About Install Command Line Tool, If you click inside dialog and ok button has lost focus then enter is not triggered. Do you want to set focus on buttons by default (and lose trigger when button lost focus) or add keyPress handler to components?
Consistent Enter, but also a consistent Space would be nice; on macOS most dialogs with more than 1 action, have the primary action respond to Enter, and highlight the secondary option to respond to Space. By hitting Tab one could move the action for Space to another option.
For example the empty trash confirmation dialog:
Primary action is blue, so can be chosen by hitting Enter, the cancel option is highlighted by a blue outline, which indicates it can be chosen by hitting Space.
Hey @iAmWillShepherd I started digging into this and I observed how the ok is triggered on the Install Command Line Tool... but when I try to follow the same pattern to the clone repo modal I really hit a wall. Let me explain.
In the command line tool modal the dialogue with the Ok button is triggered because of this line of code:
I tried to create a 2nd onSubmit but that was a mistake and got an error from it. Any ideas how should I add the onSubmit={this.props.onDismissed} in the clone repo modal?
I want to continue and work on the rest of the modals in this issue but this is an intro question that I have regarding this issue. Thanks in advance.
P.s Also I would love to know if my approach finding what needs to be fixed and how is the "correct" one or if I need to think about it differently.
@agisilaos, so sorry I'm getting to this so late. I think the issue is about consistency with actions. In your second example, the correct action to take on enter is to Clone, not dismiss the dialog. Maybe we can make esc the default key to close a modal?
Makes total sense, thank you for getting back to me with that info. Will work on that and I will let you know if I have any questions etc. @iAmWillShepherd!
@iAmWillShepherd The current issue that we have here is that when you press enter after you selected a repo to clone nothing happens. If you press esc the dialog dismiss just fine. I'm trying to achieve what @tierninho mentioned in the issue description:
hit enter after selecting a repo on the Clone Repo modal and the Clone is not triggered.
How I make the clone to be triggered after tapping enter? That's why I followed up with my question above. Sorry if that didn't make sense in the first place.
I would like to alter the focus of this issue to clearly defining what the expected behavior is before we move on to implementation. @koenpunt shows some examples where the dialog doesn't contain any input fields and it's hard not to agree with the behavior outlined there but I'd like to see some references to macOS and Windows interface guidelines so that we can accurately capture the expected behavior on both platforms.
Is this a matter of automatically focusing the correct button when there's not input fields in the dialog or is the expected behavior that Enter should automatically focus and execute the primary non-destructive action regardless of where focus lies inside of the dialog?
I'm going to remove the good-first-issue as issues labeled as such should have clear steps and well-defined goals for success but I'm keeping the help-wanted to get some input on the UX.
Configure a push button the user is highly likely to select as the default. A default push button is prominent in appearance and automatically performs its action when the user presses Return. There can only be a single default button in a view.
Default is always rightmost, usually lower right of dialog, filled with highlight colour, activates using Return.
Secondary option always has focus, outlined with highlight colour, usually to the left of the default option, activates using Space.
Include a trailing ellipsis in the title when a push button opens another window, dialog, or app. For example, the Edit buttons in the AutoFill pane of Safari Preferences include ellipses because they open other dialogs or windows that let the user modify autofill values.
Avoid providing introductory labels. Push button titles should be descriptive enough that a label is unnecessary.
Separate destructive buttons from nondestructive controls. Destructive buttons should be far enough away from other elements that the user has to make an intentional effort to click the button.
@gingerbeardman Where do you see that "default is always rightmost" in the macOS guidelines? I couldn't find that anywhere, and a quick check of deleting something in my trash runs counter to that.
And it's also not true that the secondary item is always focussed. If you do CMD+ALT+BACKSPACE on a file, you'll get an dialog that has the Cancel button as primary, which is also the focussed button;
Place buttons where people expect them.In general, the button people are most likely to choose should be on the right. The default button should always be on the right. Cancel buttons are typically on the left.
Empty Trash (destructive) case
Include a Cancel button when there’s a destructive button. A Cancel button provides a clear, safe way to opt out of a destructive action. Consider making the Cancel button the default button too, requiring the user to intentionally click a button to continue with the destructive action.
Generally, use two-button alerts. Two-button alerts provide an easy choice between two alternatives. Single-button alerts inform, but give no control over the situation. Alerts with three or more buttons create complexity.
Give alert buttons succinct, logical titles. The best button titles consist of one or two words that describe the result of clicking the button. As with all button titles, use title-style capitalization and no ending punctuation. To the extent possible, use verbs and verb phrases that relate directly to the alert title and message—for example, View All, Reply, or Ignore. Use OK for simple acceptance. Avoid using Yes and No.
Ensure that the default button title reflects the action the button performs. Avoid using OK for the default button unless the alert is purely informational. The meaning of OK can be unclear even in alerts that ask if the user is sure they want to do something. For example, does OK mean “OK, I want to complete the action” or “OK, I now understand the negative results my action would have caused”? A specific button title like Erase, Convert, Clear, or Delete helps the user understand the action they’re taking.
Place buttons where people expect them. In general, the button people are most likely to choose should be on the right. The default button should always be on the right. Cancel buttons are typically on the left.
Label cancellation buttons appropriately. A button that cancels an alert’s action should always be labeled Cancel.
Include a Cancel button when there’s a destructive button. A Cancel button provides a clear, safe way to opt out of a destructive action. Consider making the Cancel button the default button too, requiring the user to intentionally click a button to continue with the destructive action.
Allow the Esc (Escape) key and Command-Period (.) keyboard shortcut to cancel alerts. Pressing Esc or Command-Period while an alert is visible should produce the same effect as clicking the Cancel button—that is, the alert is dismissed without performing any action. If your alert doesn’t have a Cancel button, consider implementing a cancel action in your code that runs when Esc or Command-Period is pressed.
Consider offering time-saving keyboard shortcuts for all buttons. For example, you could let people activate a Print button by pressing the P key, or a Don't Save button by pressing the D or Delete key.
It seems like Cancel should be the default when the action is destructive, and the destructive action should be on the right since that’s the most common action.
It seems like Cancel should be the default when the action is destructive, and the destructive action should be on the right since that’s the most common action.
Btw, moving a file to the trash is not seen as destructive apparently, because there the cancel button is not the default.
Activity
http-request commentedon Dec 19, 2017
@tierninho About
Install Command Line Tool, If you click inside dialog andokbutton has lost focus thenenteris not triggered. Do you want to set focus on buttons by default (and lose trigger when button lost focus) or add keyPress handler to components?koenpunt commentedon Jan 11, 2018
Consistent Enter, but also a consistent Space would be nice; on macOS most dialogs with more than 1 action, have the primary action respond to Enter, and highlight the secondary option to respond to Space. By hitting Tab one could move the action for Space to another option.
For example the empty trash confirmation dialog:
Primary action is blue, so can be chosen by hitting Enter, the cancel option is highlighted by a blue outline, which indicates it can be chosen by hitting Space.
Then when I hit Tab once, it looks like this:
Now I can confirm with both Space and Enter.
agisilaos commentedon Feb 1, 2018
Hey @iAmWillShepherd I started digging into this and I observed how the
okis triggered on theInstall Command Line Tool...but when I try to follow the same pattern to the clone repo modal I really hit a wall. Let me explain.In the command line tool modal the dialogue with the Ok button is triggered because of this line of code:
desktop/app/src/ui/cli-installed/cli-installed.tsx
Line 23 in d0dab86
But when I try to do something simillar for the Clone Repo modal, the "on Submit" line of code looks like that:
desktop/app/src/ui/clone-repository/clone-repository.tsx
Line 96 in d0dab86
I tried to create a 2nd onSubmit but that was a mistake and got an error from it. Any ideas how should I add the
onSubmit={this.props.onDismissed}in the clone repo modal?I want to continue and work on the rest of the modals in this issue but this is an intro question that I have regarding this issue. Thanks in advance.
P.s Also I would love to know if my approach finding what needs to be fixed and how is the "correct" one or if I need to think about it differently.
iAmWillShepherd commentedon Mar 5, 2018
@agisilaos, so sorry I'm getting to this so late. I think the issue is about consistency with actions. In your second example, the correct action to take on enter is to Clone, not dismiss the dialog. Maybe we can make esc the default key to close a modal?
agisilaos commentedon Mar 6, 2018
Makes total sense, thank you for getting back to me with that info. Will work on that and I will let you know if I have any questions etc. @iAmWillShepherd!
iAmWillShepherd commentedon Mar 6, 2018
@agisilaos, I'm sure you know by now, but could you add
Fixes #3629at the top of your PR body when you open it?agisilaos commentedon Mar 13, 2018
@iAmWillShepherd The current issue that we have here is that when you press enter after you selected a repo to clone nothing happens. If you press esc the dialog dismiss just fine. I'm trying to achieve what @tierninho mentioned in the issue description:
How I make the clone to be triggered after tapping enter? That's why I followed up with my question above. Sorry if that didn't make sense in the first place.
niik commentedon Mar 19, 2018
I would like to alter the focus of this issue to clearly defining what the expected behavior is before we move on to implementation. @koenpunt shows some examples where the dialog doesn't contain any input fields and it's hard not to agree with the behavior outlined there but I'd like to see some references to macOS and Windows interface guidelines so that we can accurately capture the expected behavior on both platforms.
Is this a matter of automatically focusing the correct button when there's not input fields in the dialog or is the expected behavior that Enter should automatically focus and execute the primary non-destructive action regardless of where focus lies inside of the dialog?
I'm going to remove
the good-first-issueas issues labeled as such should have clear steps and well-defined goals for success but I'm keeping thehelp-wantedto get some input on the UX.cc @donokuda @ampinsk
gingerbeardman commentedon Mar 19, 2018
macOS Human Interface Guidelines
https://developer.apple.com/macos/human-interface-guidelines/buttons/push-buttons/
Default is always rightmost, usually lower right of dialog, filled with highlight colour, activates using Return.
Secondary option always has focus, outlined with highlight colour, usually to the left of the default option, activates using Space.
billygriffin commentedon Oct 2, 2018
@gingerbeardman Where do you see that "default is always rightmost" in the macOS guidelines? I couldn't find that anywhere, and a quick check of deleting something in my trash runs counter to that.
koenpunt commentedon Oct 2, 2018
What @billygriffin says is true.
And it's also not true that the secondary item is always focussed. If you do CMD+ALT+BACKSPACE on a file, you'll get an dialog that has the
Cancelbutton as primary, which is also the focussed button;gingerbeardman commentedon Oct 2, 2018
@billygriffin @koenpunt
General case
Empty Trash (destructive) case
https://developer.apple.com/design/human-interface-guidelines/macos/windows-and-views/alerts/
In full...
j-f1 commentedon Oct 2, 2018
It seems like Cancel should be the default when the action is destructive, and the destructive action should be on the right since that’s the most common action.
gingerbeardman commentedon Oct 2, 2018
@j-f1 indeed, see point 6 in the list (and my edit above)
koenpunt commentedon Oct 2, 2018
Btw, moving a file to the trash is not seen as destructive apparently, because there the cancel button is not the default.
gingerbeardman commentedon Oct 2, 2018
@koenpunt the default button is the blue one
koenpunt commentedon Oct 2, 2018
Oh I meant emptying the trash;
gingerbeardman commentedon Oct 2, 2018
Interesting.
So immediate deletion is seen as destructive, but emptying the Trash is not.
I could only guess at the reasoning.
ruggi99 commentedon Jun 8, 2020
@tierninho could you update this issue if you have the time?
sergiou87 commentedon Sep 24, 2024
This was fixed in recent accessibility work
gingerbeardman commentedon Sep 24, 2024
Praise be!
Only 7 years, some sort of record I imagine.
All the more confusing to have "not-planned" label.