Commit 9cc2ca4c authored by Thomas Tellier's avatar Thomas Tellier Committed by Commit Bot

[CrOs] Fix focus on wrong password submitted for login/lock screen

Bug: 1115024
Change-Id: I0a025910e4362c9a118d725293f7c5c2f477a33c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362735
Commit-Queue: Thomas Tellier <tellier@google.com>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800169}
parent 9b50996d
...@@ -752,7 +752,6 @@ void LoginPasswordView::ContentsChanged(views::Textfield* sender, ...@@ -752,7 +752,6 @@ void LoginPasswordView::ContentsChanged(views::Textfield* sender,
// The feature could be enabled on the device but disabled for this user by policy. // The feature could be enabled on the device but disabled for this user by policy.
if (display_password_button_->GetVisible()) if (display_password_button_->GetVisible())
clear_password_timer_->Reset(); clear_password_timer_->Reset();
display_password_button_->SetEnabled(!new_contents.empty());
} }
// Implements swapping active user with arrow keys // Implements swapping active user with arrow keys
...@@ -783,7 +782,17 @@ bool LoginPasswordView::HandleKeyEvent(views::Textfield* sender, ...@@ -783,7 +782,17 @@ bool LoginPasswordView::HandleKeyEvent(views::Textfield* sender,
} }
void LoginPasswordView::UpdateUiState() { void LoginPasswordView::UpdateUiState() {
submit_button_->SetEnabled(IsPasswordSubmittable()); bool enable_buttons = IsPasswordSubmittable();
// Disabling the submit button will make it lose focus. The previous focusable
// view will be the password textfield, which is more expected than the user
// drop down button.
if (!enable_buttons && submit_button_->HasFocus())
textfield_->RequestFocus();
submit_button_->SetEnabled(enable_buttons);
if (!is_display_password_feature_enabled_)
return;
display_password_button_->SetEnabled(enable_buttons);
} }
void LoginPasswordView::OnCapsLockChanged(bool enabled) { void LoginPasswordView::OnCapsLockChanged(bool enabled) {
......
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