Commit d6ae375d authored by Xing Liu's avatar Xing Liu Committed by Chromium LUCI CQ

Read later: Fix snackbar talkback.

For snackbars that don't have action buttons, currently talkback will
read out "Added to reading list. null. Options available near bottom of
the screen".

We should check whether content description for the action button is
null when generating the accessibility string.

Bug: 1164726
Change-Id: Iac7b286a442ce4be01323f686dfc558be56cf33e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622735
Commit-Queue: Xing Liu <xingliu@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarPavel Yatsuk <pavely@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842657}
parent e35e978e
...@@ -206,9 +206,16 @@ public class SnackbarView { ...@@ -206,9 +206,16 @@ public class SnackbarView {
* the mMessageView content description is read aloud if accessibility is enabled. * the mMessageView content description is read aloud if accessibility is enabled.
*/ */
public void announceforAccessibility() { public void announceforAccessibility() {
mMessageView.announceForAccessibility(mMessageView.getContentDescription() + ". " StringBuilder accessibilityText = new StringBuilder(mMessageView.getContentDescription());
+ mActionButtonView.getContentDescription() + ". " if (mActionButtonView.getContentDescription() != null) {
+ mContainerView.getResources().getString(R.string.bottom_bar_screen_position)); accessibilityText.append(". ")
.append(mActionButtonView.getContentDescription())
.append(". ")
.append(mContainerView.getResources().getString(
R.string.bottom_bar_screen_position));
}
mMessageView.announceForAccessibility(accessibilityText);
} }
/** /**
......
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