question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tablayout] Accessibility issues

See original GitHub issue

Description: I am using a Material Tablayout connected with a viewpager2 for an onboarding experience. My Tablayout setup looks like this:

<com.google.android.material.tabs.TabLayout
        android:id="@+id/onboardingSelector"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/onboardingPages"
        app:tabBackground="@drawable/tab_selector"
        app:tabGravity="center"
        app:tabIndicatorHeight="0dp" />

While running this screen through Accessibility Scanner and Google play console Pre launch reports, I am getting below warnings for the dot tabBackground

This item may not have a label readable by screen readers.

This item’s width is 24dp. Consider making the width of this touch target 48dp or larger.

How can I fix these ? Should the material ui library come with the support for this setup?

Android API version: Android 9

Material Library version: 1.3.0-alpha02

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mbarakacommented, Jun 16, 2021

@ahetawal-p you can try the following to fix the Accessibility text

TabLayoutMediator(into_tab_layout, viewpager2)
        { tab, position ->
           // configure the tab information here as you wish
            tab.contentDescription = "Page ${position + 1}"
        }.attach()

I am not sure about the tab dot size though

0reactions
drchencommented, Jun 10, 2022

I’ll close the issue as WAI.

The content description of tabs is supposed to be set by clients via providing with TabItem or Tab, or as what @mbaraka suggested, providing a custom TabConfigurationStrategy to set up a default content desc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Material TabLayout Access Issue - Stack Overflow
I am using support design version 28.0.0 in my app and trying to use material tablayout in XML. com.google.android.material.tabs.TabLayout.
Read more >
Accessible Tabbed Navigation in Android - Deque Systems
By default, TabWidgets are not accessible in Android. To make them accessible, they need customization that adds their name, role, value, and ...
Read more >
Accessibility at STRV: Android Best Practices
The Android Toolbar is not accessible while using a keyboard for navigation. This is a huge issue and may cause you headaches if...
Read more >
Apply visual attributes to tab layout - Android Tutorial - LinkedIn
Let's run it and see how it works. - [Talk Back] Apps, home, accessibility examples. - [Instructor] Go to the tab layout. -...
Read more >
Android develop - Vocal navigation
Vocal navigation, accessibility dev recommandations with Android. ... below a ViewPager in one case in TabLayout and in the other in BottomNavigationView ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found