Commit 03312b6d authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

mac: wire up pane traversal keys

This change adds two new global key bindings:
Command-Option-UpArrow traverses to the next accessible pane
Command-Option-Shift-UpArrow traverses to the previous accessible pane

This allows keyboard access to:
* The downloads bar
* Bubbles that don't grab focus when they appear
* The toolbar
etc etc.

This is the approach proposed by UX in
https://bugs.chromium.org/p/chromium/issues/detail?id=919260#c20,
but I decided to use the (imo more Mac-like) "shift means backward"
convention rather than using DownArrow for forward and UpArrow for
backward.

Bug: 919260,956432,945923
Change-Id: I4d15d706b903d1be9d1894725f96107a4b6b1373
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856888
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705285}
parent 54b9b423
...@@ -168,6 +168,9 @@ const std::vector<KeyboardShortcutData>& GetShortcutsNotPresentInMainMenu() { ...@@ -168,6 +168,9 @@ const std::vector<KeyboardShortcutData>& GetShortcutsNotPresentInMainMenu() {
{true, false, false, true, kVK_ANSI_L, IDC_SHOW_DOWNLOADS}, {true, false, false, true, kVK_ANSI_L, IDC_SHOW_DOWNLOADS},
{true, true, false, false, kVK_ANSI_C, IDC_DEV_TOOLS_INSPECT}, {true, true, false, false, kVK_ANSI_C, IDC_DEV_TOOLS_INSPECT},
{true, false, false, true, kVK_ANSI_C, IDC_DEV_TOOLS_INSPECT}, {true, false, false, true, kVK_ANSI_C, IDC_DEV_TOOLS_INSPECT},
{true, false, false, true, kVK_UpArrow, IDC_FOCUS_NEXT_PANE},
{true, true, false, true, kVK_UpArrow, IDC_FOCUS_PREVIOUS_PANE},
}); });
// clang-format on // clang-format on
return *keys; return *keys;
......
...@@ -32,6 +32,19 @@ int CommandForKeys(bool command_key, ...@@ -32,6 +32,19 @@ int CommandForKeys(bool command_key,
if (opt_key) if (opt_key)
modifierFlags |= NSAlternateKeyMask; modifierFlags |= NSAlternateKeyMask;
switch (vkey_code) {
case kVK_UpArrow:
case kVK_DownArrow:
case kVK_LeftArrow:
case kVK_RightArrow:
// Docs say this is set whenever a key came from the numpad *or* the arrow
// keys.
modifierFlags |= NSEventModifierFlagNumericPad;
break;
default:
break;
}
unichar shifted_character; unichar shifted_character;
unichar character; unichar character;
int result = ui::MacKeyCodeForWindowsKeyCode( int result = ui::MacKeyCodeForWindowsKeyCode(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment