Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1728)

Issue 2607923002: MacViews: Handle Space and Return keys correctly for Buttons. (Closed)

Created:
3 years, 11 months ago by karandeepb
Modified:
3 years, 11 months ago
Reviewers:
tapted
CC:
chromium-reviews, tfarina, mac-reviews_chromium.org, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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. Committed: https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23 Cr-Commit-Position: refs/heads/master@{#441622}

Patch Set 1 #

Patch Set 2 : -- #

Patch Set 3 : -- #

Patch Set 4 : -- #

Total comments: 25

Patch Set 5 : Address review. #

Total comments: 10

Patch Set 6 : Address review. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+128 lines, -37 lines) Patch
M ui/views/controls/button/custom_button.h View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M ui/views/controls/button/custom_button.cc View 1 2 3 4 5 4 chunks +40 lines, -24 lines 0 comments Download
M ui/views/controls/button/custom_button_unittest.cc View 1 2 3 4 5 3 chunks +45 lines, -9 lines 0 comments Download
M ui/views/style/platform_style.h View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M ui/views/style/platform_style.cc View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M ui/views/style/platform_style_mac.mm View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M ui/views/window/dialog_delegate_unittest.cc View 1 2 3 4 1 chunk +18 lines, -4 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 44 (36 generated)
karandeepb
PTAL Trent. Also looked at CustomButton::OnKeyPressed overrides. Most of them were in ui/app_list, which I ...
3 years, 11 months ago (2017-01-04 03:55:41 UTC) #13
tapted
https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (left): https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc#oldcode311 ui/views/controls/button/custom_button.cc:311: (event.key_code() == ui::VKEY_RETURN); On 2017/01/04 03:55:40, karandeepb wrote: > ...
3 years, 11 months ago (2017-01-04 04:54:31 UTC) #18
karandeepb
PTAL Trent. https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (left): https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc#oldcode311 ui/views/controls/button/custom_button.cc:311: (event.key_code() == ui::VKEY_RETURN); >> I think it ...
3 years, 11 months ago (2017-01-04 06:14:46 UTC) #23
tapted
lgtm % nits https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (left): https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc#oldcode311 ui/views/controls/button/custom_button.cc:311: (event.key_code() == ui::VKEY_RETURN); On 2017/01/04 06:14:45, ...
3 years, 11 months ago (2017-01-05 00:34:41 UTC) #26
karandeepb
https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc File ui/views/controls/button/custom_button.cc (left): https://codereview.chromium.org/2607923002/diff/80001/ui/views/controls/button/custom_button.cc#oldcode311 ui/views/controls/button/custom_button.cc:311: (event.key_code() == ui::VKEY_RETURN); > Ah, right. yeah that last ...
3 years, 11 months ago (2017-01-05 10:50:09 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2607923002/240001
3 years, 11 months ago (2017-01-05 10:51:55 UTC) #39
commit-bot: I haz the power
Committed patchset #6 (id:240001)
3 years, 11 months ago (2017-01-05 10:56:06 UTC) #42
commit-bot: I haz the power
3 years, 11 months ago (2017-01-05 10:58:41 UTC) #44
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/dfd313b6e9b08551787c6938a04ab1e2814c0f23
Cr-Commit-Position: refs/heads/master@{#441622}

Powered by Google App Engine
This is Rietveld 408576698