0

Virtual Desk: Add accessible name to desk preview view.

Since desk preview view is focusible now, we need to add accessible
name to meet below requirment:

If view is focusable, it requires to have an accessible name or placeholder, or explicitly marked as empty. Thus if this is production code, the accessible name should be localized.

Fixed: b/300013643
Test: Existing Unit Tests
Change-Id: If14b0aef8fcaa993bcdcc005a67348ea7506dccc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906607
Reviewed-by: Daniel Andersson <dandersson@chromium.org>
Commit-Queue: Judy Wang <shidi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204194}
This commit is contained in:
Judy Wang
2023-10-02 19:16:40 +00:00
committed by Chromium LUCI CQ
parent f1b704d288
commit 3385d2f96f
3 changed files with 5 additions and 0 deletions

@ -2595,6 +2595,9 @@ Style notes:
<message name="IDS_ASH_DESKS_DESK_NAME" desc="Alert when highlighting the desk name">
Desk name
</message>
<message name="IDS_ASH_DESKS_DESK_PREVIEW" desc="The desk preview accessible name">
Desk preview
</message>
<message name="IDS_ASH_DESKS_DESK_ACCESSIBLE_NAME" desc="The full accessible desk name">
Desk: <ph name="DESK_NAME">$1</ph>
</message>

@ -0,0 +1 @@
c14144b250b790a2418b3df1a4faf92ba4a50d26

@ -359,6 +359,7 @@ DeskPreviewView::DeskPreviewView(PressedCallback callback,
views::InkDrop::Get(this)->SetMode(views::InkDropHost::InkDropMode::OFF);
SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
SetPaintToLayer(ui::LAYER_TEXTURED);
SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_DESKS_DESK_PREVIEW));
layer()->SetFillsBoundsOpaquely(false);
layer()->SetMasksToBounds(false);