Skip to content

Commit b247e00

Browse files
wcshidsn5ft
authored andcommitted
Add Talkback support for badge + TabLayout.
PiperOrigin-RevId: 250397444
1 parent 111cd00 commit b247e00

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/java/com/google/android/material/tabs/TabLayout.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,7 @@ public TabView(Context context) {
22322232
setClickable(true);
22332233
ViewCompat.setPointerIcon(
22342234
this, PointerIconCompat.getSystemIcon(getContext(), PointerIconCompat.TYPE_HAND));
2235+
ViewCompat.setAccessibilityDelegate(this, null);
22352236
}
22362237

22372238
private void updateBackgroundDrawable(Context context) {
@@ -2363,6 +2364,11 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
23632364
super.onInitializeAccessibilityNodeInfo(info);
23642365
// This view masquerades as an action bar tab.
23652366
info.setClassName(ActionBar.Tab.class.getName());
2367+
if (badgeDrawable != null && badgeDrawable.isVisible()) {
2368+
CharSequence customContentDescription = getContentDescription();
2369+
info.setContentDescription(
2370+
customContentDescription + ", " + badgeDrawable.getContentDescription(getContext()));
2371+
}
23662372
}
23672373

23682374
@Override

0 commit comments

Comments
 (0)