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] Tab automatically scrolls to the left on scroll to the right

See original GitHub issue

Using Tabs, if you have one of the selected (Tabs value matches with that specific) Tab to have style with display = none, Tabs scroll to the left upon scroll to the right.

I was originally encountering this issue when I wanted to have no tab selected on load, and have a empty tab with display: none so that they can start clicking on it, as Tabs API will give warnings/errors on console if you have value that doesn’t match with any of the <Tab …> in the children. There was no explanation as to how to have it no tab selected on the Tabs either. The workaround was to have <Tabs … value={false}>, which I found from one of StackOverflow answers, but it is not described on Tabs API page either.

  • [ x ] The issue is present in the latest release.
  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Pressing right scroll button on the Tab scrolls to the right, and then scrolls to the left.

Expected Behavior 🤔

Pressing right scroll button on the Tab scrolls to the right, and stay that way.

Steps to Reproduce 🕹

https://codesandbox.io/s/material-demo-forked-ob22h?file=/demo.js The only thing I have changed from Demo source code is to have display none on the selected tab.

Steps:

  1. go to https://codesandbox.io/s/material-demo-forked-ob22h?file=/demo.js
  2. click Right scroll button

Context 🔦

Explain how we can have a Tabs with no value selected mode, or explain that selected Tab with display: none will cause unintended behaviors and specify to just have value={false} on Tabs to achieve the same result of having no Tab selected on initial.

Your Environment 🌎

`npx @material-ui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @material-ui/envinfo` goes here.

System:
    OS: macOS 11.4
  Binaries:
    Node: 16.2.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.13.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 91.0.4472.77
    Edge: Not Found
    Firefox: 89.0
    Safari: 14.1.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ryank425commented, Jun 3, 2021

The issue seems to be fixed in v5: https://codesandbox.io/s/material-demo-forked-jozdw?file=/demo.js. Can you confirm?

The exact same thing happens in Chrome, and Firefox.

0reactions
sakura90commented, Jun 6, 2021

@ryank425 See the docs: https://material-ui.com/api/tabs/

image

The v4 doc describes <Tabs … value={false}> on Tabs API page. What about closing the issue and reopening the issue if you would like to?

@oliviertassinari What about closing the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

scrolls to the right/end of my open tabs uncontrolably.
try use left arrow or scroll wheel to go to the left and just immediately mouse over to click a particular tab and...
Read more >
Automatically page scrolls to top when switching between tabs
Inside the handleTabChange callback, using the ref.currentElement set the scrollTop property to 0. Share.
Read more >
Uncontrollable Scrolling - Microsoft Community
Anywhere in the settings app, if the page can be scrolled down it will scroll down to the bottom even after resizing the...
Read more >
Enable or Disable Scrollable Tabstrip in Google Chrome
To Enable or Disable Scrollable Tabstrip in Google Chrome, · Open Google Chrome. · Select Enabled from the drop-down menu next to the...
Read more >
Help: issue of shifting tabs when scrolling left : r/sheets - Reddit
There is hopefully an easy solution to this problem, but I have been through google search results without success so I'm trying Reddit....
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