Commit 91b01545 authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Keyboard accessibility for extensions menu.

This change switches the extensions menu to enable focus traversal at
the focus manager level, allowing both right/left and up/down key
traversal.

It also removes
BubbleDialogDelegateView::EnableUpDownKeyboardAccelerators() - which is
only used in one other place - in favor of
FocusManager::set_arrow_key_traversal_enabled(), which also supports
left/right arrows and pre-exists the bubble dialog method.

These changes mean that when the scroll pane is active in either dialog,
up and down will scroll the pane but left and right arrow keys will
still allow the user to traverse the dialog (at least on Windows and
Linux; on Mac, up/down may still work within the pane).

Bug: 1140632
Change-Id: I8ea5bc79e9b9ed2595e9503be1221843c50a7b3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487904Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820456}
parent c224fbc5
......@@ -87,7 +87,7 @@ ExtensionsMenuView::ExtensionsMenuView(
SetShowCloseButton(true);
SetTitle(IDS_EXTENSIONS_MENU_TITLE);
EnableUpDownKeyboardAccelerators();
GetFocusManager()->set_arrow_key_traversal_enabled(true);
// Let anchor view's MenuButtonController handle the highlight.
set_highlight_button_when_shown(false);
......
......@@ -523,7 +523,7 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button,
DCHECK(anchor_button);
anchor_button->AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr);
EnableUpDownKeyboardAccelerators();
GetFocusManager()->set_arrow_key_traversal_enabled(true);
GetViewAccessibility().OverrideRole(ax::mojom::Role::kMenu);
}
......
......@@ -736,12 +736,6 @@ void BubbleDialogDelegateView::UpdateColorsFromTheme() {
: nullptr);
}
void BubbleDialogDelegateView::EnableUpDownKeyboardAccelerators() {
// The arrow keys can be used to tab between items.
AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE));
AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE));
}
void BubbleDialogDelegate::OnBubbleWidgetVisibilityChanged(bool visible) {
UpdateHighlightedButton(visible);
......
......@@ -408,9 +408,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public BubbleDialogDelegate,
// Perform view initialization on the contents for bubble sizing.
void Init() override;
// Allows the up and down arrow keys to tab between items.
void EnableUpDownKeyboardAccelerators();
private:
FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate);
FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, NonClientHitTest);
......
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