Commit 10cca41b authored by Guido Trotter's avatar Guido Trotter Committed by Commit Bot

[CrOS] OAC: Read user info dialog on lock screen

Currently when the info dialog doesn't have the remove button, its text
is not read on opening, and it is not accessible via ChromeVox controls.

This patch fixes it, by reading it out by default, on opening.
Signed-off-by: default avatarGuido Trotter <ultrotter@chromium.org>
Fixed: 901427
Change-Id: I091e9ff9c2e32a9fc1dc40ada25b2bccea8fe569
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544969Reviewed-by: default avatarThomas Tellier <tellier@google.com>
Cr-Commit-Position: refs/heads/master@{#829247}
parent a1d8ade3
......@@ -143,7 +143,6 @@ LoginUserMenuView::LoginUserMenuView(
bubble_opener_(bubble_opener),
on_remove_user_warning_shown_(on_remove_user_warning_shown),
on_remove_user_requested_(on_remove_user_requested) {
set_notify_alert_on_show(false);
const base::string16& email =
base::UTF8ToUTF16(user.basic_user_info.display_email);
......@@ -172,11 +171,11 @@ LoginUserMenuView::LoginUserMenuView(
kUserMenuFontSizeUsername, gfx::Font::Weight::MEDIUM),
kUserMenuLineHeightUsername);
container->AddChildView(username_label_);
views::Label* email_label = login_views_utils::CreateBubbleLabel(
email_label_ = login_views_utils::CreateBubbleLabel(
email, nullptr,
AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary));
container->AddChildView(email_label);
container->AddChildView(email_label_);
}
// User is managed.
......@@ -193,6 +192,11 @@ LoginUserMenuView::LoginUserMenuView(
AddChildView(managed_user_data_);
}
// If we can remove the user, the focus will be trapped by the bubble, and
// button. If we can't, and there is no button, we set this so that the bubble
// accessible data is displayed by accessibility tools.
set_notify_alert_on_show(!user.can_remove);
// Remove user.
if (user.can_remove) {
DCHECK(!is_owner);
......@@ -276,10 +280,21 @@ const char* LoginUserMenuView::GetClassName() const {
}
void LoginUserMenuView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->SetName(l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_ACCESSIBLE_NAME));
node_data->SetDescription(l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_ACCESSIBLE_DESCRIPTION));
if (remove_user_button_) {
node_data->SetName(l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_ACCESSIBLE_NAME));
node_data->SetDescription(l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_ACCESSIBLE_DESCRIPTION));
} else {
node_data->SetName(username_label_->GetText());
if (management_disclosure_label_) {
node_data->SetDescription(
base::StrCat({email_label_->GetText(), base::ASCIIToUTF16(" "),
management_disclosure_label_->GetText()}));
} else {
node_data->SetDescription(email_label_->GetText());
}
}
node_data->role = ax::mojom::Role::kDialog;
node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kModal, true);
}
......
......@@ -73,6 +73,7 @@ class ASH_EXPORT LoginUserMenuView : public LoginBaseBubbleView,
views::View* remove_user_confirm_data_ = nullptr;
RemoveUserButton* remove_user_button_ = nullptr;
views::Label* username_label_ = nullptr;
views::Label* email_label_ = nullptr;
views::Label* management_disclosure_label_ = nullptr;
base::string16 warning_message_;
......
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