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.

[Tabs] Scroll buttons are not displayed if scrollButtons="auto" and on mobile

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When scrollButtons="auto" it never shows the scroll buttons even when tabs are not fully visible within Mobile View. The description of this prop says it should display the buttons whenever tabs are cut off.

From Tabs API

Determine behavior of scroll buttons when tabs are set to scroll:

  • auto will only present them when not all the items are visible. - desktop will only present them on medium and larger viewports. - on will always present them. - off will never present them.
Screen Shot 2020-09-14 at 12 19 01 PM

Expected Behavior 🤔

Scroll buttons should display in mobile view if tabs are not fully visible.

Steps to Reproduce 🕹

You can see the behavior in this Codesandbox: https://codesandbox.io/s/material-demo-forked-gdrfp?file=/demo.js taken from https://github.com/mui-org/material-ui/issues/22592.

Context 🔦

We have a subnavbar with scrollable tabs, we want the buttons to not appear (no left/right padding) in desktop since there’s enough space to view all the tabs, but in mobile view, we want the scroll buttons to appear to signal to the user that there are additional items to see by scrolling right. We believe this is what the auto setting is supposed to achieve with scrollButtons prop.

Your Environment 🌎

Tech Version
Material-UI ^4.9.5

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
oliviertassinaricommented, Sep 15, 2020

@mnajdova I couldn’t remember, we did that 1 year ago, I have blamed the line to learn more about it. The logic comes from #15676, which links back to https://github.com/mui-org/material-ui/issues/15324#issuecomment-485774808. The current default behavior seems correct. It seems to be so we match the specification that never displays the buttons on mobile: https://material.io/components/tabs#anatomy.

On desktop, provide a visual indicator that more tabs are available off screen.

However, we can probably improve the DX, change the API. It seems that there are different dimensions:

  • Some might want the scroll buttons to lazily use space: #12358
  • Some might not want to display the scroll buttons, ever, on touch pointer devices: the Material Design spec.
  • Some might want to force the display of the scroll buttons, to be always visible (and add an opacity): #22181.
1reaction
brorlarsnicklascommented, Sep 21, 2020

Can I work on a PR for this? 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tabs] Scroll buttons are not displayed if scrollButtons="auto ...
When scrollButtons="auto" it never shows the scroll buttons even when tabs are not fully visible within Mobile View.
Read more >
Material ui tabs not scrollable on mobile view - Stack Overflow
We have around 4 tabs. One of the tab is cut off as we are trying to render it in mobile view as...
Read more >
Scroll buttons do not appear until new tab loaded - Telerik
Click one of the visible tabs. The scroll buttons will disappear, but the tab strip will not redraw! The tabs that were scrolled...
Read more >
Tabs API - Material-UI
Name Type Default action func centered bool false children node
Read more >
Sheet tab scroll buttons don't work in excel 2010
Those scroll buttons work only when you have many sheet tabs and they are not all visible. Gord. Was this reply helpful ...
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