New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 607430 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 603386
issue 636676



Sign in to add a comment

MacViews: Enter key should click the default button, or perform the default action.

Project Member Reported by karandeepb@chromium.org, Apr 28 2016

Issue description

Version: 52.0.2719.0
OS: Mac
What steps will reproduce the problem?
(1) Enable chrome://flags/#mac-views-dialogs
(2) Open bookmark bubble by clicking on Star icon to the right of address bar.
(3) Shift focus to Edit button.
(4) Press Enter key.

What is the expected output?
A new bookmark should be created, as if we had press the Done button

What do you see instead?
The Edit bookmark dialog opens.

See https://support.apple.com/en-au/HT204434
 
Components: Internals>Views
Owner: karandeepb@chromium.org
Blocking: 636676
Cc: tapted@chromium.org shrike@chromium.org
Is there consensus on what to do here? 

Trent had put up some suggestions - https://docs.google.com/a/google.com/document/d/1gXClbPwv7PK-zzeFaoGdgELNznPtgFbCXfJ6wgMAE4Q/edit?usp=sharing 
See the "Default Button" section.

Comment 5 by shrike@chromium.org, Oct 20 2016

On the Mac we should follow the platform convention, where Return activates the Default button even if there's another button or control that's focused.

Comment 6 by tapted@chromium.org, Oct 25 2016

That doesn't exactly rule-out making the usually-default button a-not-a-default-button when another button (specifically a button - e.g. not a textfield) has focus.

There's a kind of precedent for this. For example, the native Save panel disables the default button when there is no text in the `Save As:` textfield. Pressing Enter does nothing in this case.

However, _disabling_ a button is not the same as removing its "default"ness. And tabbing around buttons in the native Save dialog doesn't remove "default"ness from Save. So, I'm fine with doing nothing here. But I still find it quite jarring that tabbing to the Cancel button on the Save dialog and pressing Enter will select `Save`, not `Cancel`.

Comment 7 by shrike@chromium.org, Oct 25 2016

It's jarring for me too, but I don't normally operate the UI in full accessibility mode. I expect this is natural/expected behavior for someone who does.

Comment 8 by tapted@chromium.org, Dec 12 2016

Blocking: 603386
Labels: Phase3
Status: Started (was: Available)
Project Member

Comment 10 by bugdroid1@chromium.org, Jan 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dfd313b6e9b08551787c6938a04ab1e2814c0f23

commit dfd313b6e9b08551787c6938a04ab1e2814c0f23
Author: karandeepb <karandeepb@chromium.org>
Date: Thu Jan 05 10:55:29 2017

MacViews: Handle Space and Return keys correctly for Buttons.

Currently on MacViews, the Space key clicks the button on key-release and the
Return key clicks the button on key-press if the button has focus. However the
Cocoa behavior is that the Space key should click the button on key-press when a
button is focused. Also the Return key should perform the default action
associated with a dialog, irrespective of the view focused.

This CL introduces two new constants to PlatformStyle to account for the special
behavior on Mac, namely kClickActionOnSpace and kReturnClicksFocusedControl.
CustomButton::OnKeyPressed, CustomButton::OnKeyReleased and
CustomButton::SkipDefaultKeyEventProcessing are modified to respect the value of
these platform specific constants. Existing unit tests are modified to be in
line with the new behavior and one new test is also added.

BUG= 607429 ,  607430 
TEST=On Mac, enable chrome://flags/#secondary-ui-md. Open the Bookmark Bubble.
Enable Full Keyboard Access(Ctrl+F7). Focus the Edit button. Verify Space
clicks the button on key-press and Return performs the default action(Done)
instead of opening the Edit Bookmark Dialog.

Review-Url: https://codereview.chromium.org/2607923002
Cr-Commit-Position: refs/heads/master@{#441622}

[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/controls/button/custom_button.cc
[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/controls/button/custom_button.h
[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/controls/button/custom_button_unittest.cc
[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/style/platform_style.cc
[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/style/platform_style.h
[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/style/platform_style_mac.mm
[modify] https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23/ui/views/window/dialog_delegate_unittest.cc

Project Member

Comment 11 by bugdroid1@chromium.org, Jan 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3da0435e15d762ba56ab91d08f3ccd63efedbeab

commit 3da0435e15d762ba56ab91d08f3ccd63efedbeab
Author: karandeepb <karandeepb@chromium.org>
Date: Thu Jan 05 12:30:21 2017

MacViews: Don't click views::Link on pressing Return key.

On Mac, the Return key is used to perform the default action associated with a
dialog even when a control is focused. Modify Link::OnKeyPressed and
Link::SkipDefaultKeyEventProcessing to respect the value of
PlatformStyle::kReturnClicksFocusedControl so that focused links are not clicked
on pressing Return. Instead on MacViews, Return is treated as an accelerator and
performs the default action.

BUG= 607430 
TEST=On Mac, enable chrome://flags/#secondary-ui-md. Open the Bookmark Bubble.
Enable Full Keyboard Access (Ctrl+F7). Ensure no user is signed onto Chromium.
Focus the "sign in to Chromium." link. Press Return key. Ensure the link is not
clicked. Instead, the default action is performed (associated with the Done
button).

Review-Url: https://codereview.chromium.org/2609943004
Cr-Commit-Position: refs/heads/master@{#441626}

[modify] https://crrev.com/3da0435e15d762ba56ab91d08f3ccd63efedbeab/ui/views/controls/link.cc

Project Member

Comment 12 by bugdroid1@chromium.org, Jan 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/95da469f19599a040d9dd93fe443e89345a65509

commit 95da469f19599a040d9dd93fe443e89345a65509
Author: karandeepb <karandeepb@chromium.org>
Date: Wed Jan 18 04:15:55 2017

MacViews: Fix combobox keyboard shortcuts.

This CL changes the following behavior on MacViews:
  - Return key on a focused combobox does nothing (It should perform the default
    action for the dialog).
  - Up/Down arrow keys open the combobox dropdown instead of changing the
    selected index directly.
  - Space key press on a combobox opens the dropdown menu even for STYLE_ACTION.
  - Home, End, Command+Up/Down open the dropdown menu.
  - F4, Page Down, Page Up on a focused combobox do nothing.

BUG= 619545 ,  607430 

Review-Url: https://codereview.chromium.org/2627013002
Cr-Commit-Position: refs/heads/master@{#444269}

[modify] https://crrev.com/95da469f19599a040d9dd93fe443e89345a65509/ui/views/controls/combobox/combobox.cc
[modify] https://crrev.com/95da469f19599a040d9dd93fe443e89345a65509/ui/views/controls/combobox/combobox.h
[modify] https://crrev.com/95da469f19599a040d9dd93fe443e89345a65509/ui/views/controls/combobox/combobox_unittest.cc

Status: Fixed (was: Started)
This is probably fixed. Most of the leaf control views I know do now ignore Return, and hence it is handled as an accelerator by the dialog.

Sign in to add a comment