0

Update accessibility of the local authentication dialog.

- Dialog close button
- Inform the user about wrong password

Change-Id: I0b87b75552587a02196ef1dfe7e22a3d2a676de0
Bug: b:291811391
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5010365
Reviewed-by: Denis Kuznetsov <antrim@chromium.org>
Commit-Queue: Istvan Nagy <iscsi@google.com>
Cr-Commit-Position: refs/heads/main@{#1221709}
This commit is contained in:
Istvan Nagy
2023-11-08 17:32:57 +00:00
committed by Chromium LUCI CQ
parent 05e758ce7e
commit d157a9dc59
4 changed files with 16 additions and 2 deletions

@ -4790,6 +4790,9 @@ Some features are limited to increase battery life.
<message name="IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_REQUEST_DESCRIPTION" desc="Description shown on the local authentication input dialog. Explains local authentication credentials should be used to unlock the device.">
Enter device password for <ph name="EMAIL">$1<ex>john.doe@example.com</ex></ph>
</message>
<message name="IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_CLOSE_DIALOG_BUTTON" desc="The close button of the local authentication input dialog.">
Close dialog
</message>
<message name="IDS_ASH_LOGIN_SECURITY_TOKEN_REQUEST_DIALOG_TITLE" desc="Title of the PIN dialog to unlock the device with a smart card.">
Smart card PIN
</message>

@ -0,0 +1 @@
44a699ae667d31b147b073879cc33c85bc3fc133

@ -227,8 +227,8 @@ LocalAuthenticationRequestView::LocalAuthenticationRequestView(
kCrossSizeDp));
close_button_->SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER);
close_button_->SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE);
close_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_BACK_BUTTON_ACCESSIBLE_NAME));
close_button_->SetAccessibleName(l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_CLOSE_DIALOG_BUTTON));
close_button_->SetFocusBehavior(FocusBehavior::ALWAYS);
close_button_view->AddChildView(close_button_.get());
@ -306,6 +306,13 @@ LocalAuthenticationRequestView::LocalAuthenticationRequestView(
LocalAuthenticationRequestView::~LocalAuthenticationRequestView() = default;
void LocalAuthenticationRequestView::GetAccessibleNodeData(
ui::AXNodeData* node_data) {
views::DialogDelegateView::GetAccessibleNodeData(node_data);
node_data->role = ax::mojom::Role::kDialog;
node_data->SetNameChecked(description_label_->GetText());
}
void LocalAuthenticationRequestView::RequestFocus() {
login_password_view_->RequestFocus();
}
@ -398,6 +405,8 @@ void LocalAuthenticationRequestView::OnAuthComplete(
LocalAuthenticationRequestViewState::kError, default_title_,
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_ERROR_AUTHENTICATING_PWD));
ClearInput();
NotifyAccessibilityEvent(ax::mojom::Event::kAlert,
true /*send_native_event*/);
SetInputEnabled(true);
} else {
LocalAuthenticationRequestWidget::Get()->Close(true /* success */);

@ -89,6 +89,7 @@ class ASH_EXPORT LocalAuthenticationRequestView
~LocalAuthenticationRequestView() override;
// views::DialogDelegateView:
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void RequestFocus() override;
gfx::Size CalculatePreferredSize() const override;
views::View* GetInitiallyFocusedView() override;