Commit efec9246 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Allow the use of arrow keys in dialogs on the login screen.

Previously, when a modal was open, the left and right arrow keys were
activating the accelerator used to toggle between users on the the
main login screen underneath.

Fixed: 1019912
Change-Id: Ibd9cde9e7239566ae75c36a388722b4a08b0a71c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1930105Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Jon Mann <jonmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718408}
parent fd3bd4a7
...@@ -2125,12 +2125,21 @@ void LockContentsView::SetDisplayStyle(DisplayStyle style) { ...@@ -2125,12 +2125,21 @@ void LockContentsView::SetDisplayStyle(DisplayStyle style) {
Layout(); Layout();
} }
bool LockContentsView::OnKeyPressed(const ui::KeyEvent& event) {
switch (event.key_code()) {
case ui::VKEY_RIGHT:
FocusNextUser();
return true;
case ui::VKEY_LEFT:
FocusPreviousUser();
return true;
default:
return false;
}
}
void LockContentsView::RegisterAccelerators() { void LockContentsView::RegisterAccelerators() {
// Accelerators that apply on login and lock: // Applies on login and lock:
accel_map_[ui::Accelerator(ui::VKEY_RIGHT, 0)] =
AcceleratorAction::kFocusNextUser;
accel_map_[ui::Accelerator(ui::VKEY_LEFT, 0)] =
AcceleratorAction::kFocusPreviousUser;
accel_map_[ui::Accelerator(ui::VKEY_V, ui::EF_ALT_DOWN)] = accel_map_[ui::Accelerator(ui::VKEY_V, ui::EF_ALT_DOWN)] =
AcceleratorAction::kShowSystemInfo; AcceleratorAction::kShowSystemInfo;
...@@ -2160,12 +2169,6 @@ void LockContentsView::RegisterAccelerators() { ...@@ -2160,12 +2169,6 @@ void LockContentsView::RegisterAccelerators() {
void LockContentsView::PerformAction(AcceleratorAction action) { void LockContentsView::PerformAction(AcceleratorAction action) {
switch (action) { switch (action) {
case AcceleratorAction::kFocusNextUser:
FocusNextUser();
break;
case AcceleratorAction::kFocusPreviousUser:
FocusPreviousUser();
break;
case AcceleratorAction::kShowSystemInfo: case AcceleratorAction::kShowSystemInfo:
ShowSystemInfo(); ShowSystemInfo();
break; break;
......
...@@ -106,8 +106,6 @@ class ASH_EXPORT LockContentsView ...@@ -106,8 +106,6 @@ class ASH_EXPORT LockContentsView
}; };
enum class AcceleratorAction { enum class AcceleratorAction {
kFocusNextUser,
kFocusPreviousUser,
kShowSystemInfo, kShowSystemInfo,
kShowFeedback, kShowFeedback,
kShowResetScreen, kShowResetScreen,
...@@ -137,6 +135,7 @@ class ASH_EXPORT LockContentsView ...@@ -137,6 +135,7 @@ class ASH_EXPORT LockContentsView
void Layout() override; void Layout() override;
void AddedToWidget() override; void AddedToWidget() override;
void OnFocus() override; void OnFocus() override;
bool OnKeyPressed(const ui::KeyEvent& event) override;
void AboutToRequestFocusFromTabTraversal(bool reverse) override; void AboutToRequestFocusFromTabTraversal(bool reverse) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
bool AcceleratorPressed(const ui::Accelerator& accelerator) override; bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
......
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