Commit 7bd2fcbd authored by Danila Kuzmin's avatar Danila Kuzmin Committed by Commit Bot

LoginUserMenuView: Fix focus for remove user button

Tab keystroke from user options menu on a lock screen should move focus
to the next available user pod or "Shut down" button, if there is no
more user pods in a row. Also focus should stay in a dropdown menu, if
keys other than Tab or Escape are pressed.

Previously any keystroke from the “Remove account” button inside the
dropdown menu has always moved focus to the “Shut down” button.

Bug: 1107667
Change-Id: I8b0579e477b9f055ead9cd13e06a88982ab31db1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418572Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Danila Kuzmin <dkuzmin@google.com>
Cr-Commit-Position: refs/heads/master@{#810161}
parent 23043119
...@@ -63,16 +63,16 @@ class RemoveUserButton : public SystemLabelButton { ...@@ -63,16 +63,16 @@ class RemoveUserButton : public SystemLabelButton {
return; return;
} }
if (event->key_code() != ui::VKEY_RETURN) { if (event->key_code() == ui::VKEY_ESCAPE ||
// The remove-user button should handle bubble dismissal and stop event->key_code() == ui::VKEY_TAB) {
// propagation, otherwise the event will propagate to the bubble widget,
// which will close itself and invalidate the bubble pointer in
// LoginUserMenuView.
event->StopPropagation();
bubble_->Hide(); bubble_->Hide();
} else { // We explicitly move focus back to the dropdown button so the Tab
views::Button::OnKeyEvent(event); // traversal works correctly.
bubble_->GetBubbleOpener()->RequestFocus();
} }
if (event->key_code() == ui::VKEY_RETURN)
views::Button::OnKeyEvent(event);
} }
LoginUserMenuView* bubble_; LoginUserMenuView* bubble_;
......
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