-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[Tabs] Fix not scrolling to correct tab after refresh when auto scrollable #46869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ZeeshanTamboli
merged 20 commits into
mui:master
from
Jayesh-11:fix/tabs-not-scrolling-to-correct-tab-issue
Sep 28, 2025
Merged
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5ec4287
added fix for tabs not scrolling to correct tab issue #44211
Jayesh-11 c9cf1de
removed unrelated change #44211
Jayesh-11 f9f46d7
Merge branch 'master' into fix/tabs-not-scrolling-to-correct-tab-issue
ZeeshanTamboli eecfe9d
added regression for LTR/RTL horizontal and vertical
Jayesh-11 80373d0
added fix for rtl auto tab scroll in view
Jayesh-11 e67c6af
Merge branch 'master' into fix/tabs-not-scrolling-to-correct-tab-issue
ZeeshanTamboli c9a3ed6
prettier
ZeeshanTamboli 6b5d7c4
Merge branch 'master' into fix/tabs-not-scrolling-to-correct-tab-issue
Jayesh-11 a1123b5
Merge branch 'fix/tabs-not-scrolling-to-correct-tab-issue' of github.…
Jayesh-11 05ab80b
added fix in accordance to the viewport shift due to scrollbuttons
Jayesh-11 e9ed88a
Merge branch 'master' into fix/tabs-not-scrolling-to-correct-tab-issue
Jayesh-11 01f78fb
Merge branch 'master' into fix/tabs-not-scrolling-to-correct-tab-issue
ZeeshanTamboli dc76cc2
Merge branch 'fix/tabs-not-scrolling-to-correct-tab-issue' of https:/…
ZeeshanTamboli 6dc9c24
Fix lint
ZeeshanTamboli 8cafe81
use scrollable
ZeeshanTamboli f1752dc
added explicit scrollable auto and updated file names
Jayesh-11 feafd74
prettier
ZeeshanTamboli 066b4fa
Merge branch 'master' into fix/tabs-not-scrolling-to-correct-tab-issue
ZeeshanTamboli e8c6ad5
remove unnecessary handler and aria-label from regression test
ZeeshanTamboli 186b877
fix typo in filename
ZeeshanTamboli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Tabs from '@mui/material/Tabs'; | ||
import Tab from '@mui/material/Tab'; | ||
|
||
export default function LTRHorizontalTabs() { | ||
const [value, setValue] = React.useState(4); | ||
|
||
const handleChange = (event, newValue) => { | ||
setValue(newValue); | ||
}; | ||
return ( | ||
<Box sx={{ width: 300, display: 'flex' }}> | ||
<Tabs | ||
value={value} | ||
variant="scrollable" | ||
scrollButtons | ||
ZeeshanTamboli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
orientation="horizontal" | ||
onChange={handleChange} | ||
aria-label="scrollable auto tabs example" | ||
> | ||
<Tab label="Tab A" /> | ||
<Tab label="Tab B" /> | ||
<Tab label="Tab C" /> | ||
<Tab label="Tab D" /> | ||
<Tab label="Tab E" /> | ||
<Tab label="Tab F" /> | ||
<Tab label="Tab G" /> | ||
</Tabs> | ||
</Box> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Tabs from '@mui/material/Tabs'; | ||
import Tab from '@mui/material/Tab'; | ||
|
||
export default function LTRVerticalTabs() { | ||
const [value, setValue] = React.useState(4); | ||
|
||
const handleChange = (event, newValue) => { | ||
setValue(newValue); | ||
}; | ||
return ( | ||
<Box sx={{ height: 200, display: 'flex' }}> | ||
<Tabs | ||
value={value} | ||
variant="scrollable" | ||
scrollButtons | ||
orientation="vertical" | ||
onChange={handleChange} | ||
aria-label="scrollable auto tabs example" | ||
> | ||
<Tab label="Tab A" /> | ||
<Tab label="Tab B" /> | ||
<Tab label="Tab C" /> | ||
<Tab label="Tab D" /> | ||
<Tab label="Tab E" /> | ||
<Tab label="Tab F" /> | ||
<Tab label="Tab G" /> | ||
</Tabs> | ||
</Box> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as React from 'react'; | ||
import { prefixer } from 'stylis'; | ||
import rtlPlugin from '@mui/stylis-plugin-rtl'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import createCache from '@emotion/cache'; | ||
import { StyleSheetManager } from 'styled-components'; | ||
import { ThemeProvider, createTheme } from '@mui/material/styles'; | ||
import Box from '@mui/material/Box'; | ||
import Tabs from '@mui/material/Tabs'; | ||
import Tab from '@mui/material/Tab'; | ||
|
||
// Create rtl cache | ||
const cacheRtl = createCache({ | ||
key: 'muirtl', | ||
stylisPlugins: [prefixer, rtlPlugin], | ||
}); | ||
|
||
export default function RTLHorizontalTabs() { | ||
return ( | ||
<StyleSheetManager stylisPlugins={[rtlPlugin]}> | ||
<CacheProvider value={cacheRtl}> | ||
<ThemeProvider theme={createTheme({ direction: 'rtl' })}> | ||
<Box dir="rtl" sx={{ width: 300, display: 'flex' }}> | ||
<Tabs value={2} variant="scrollable" scrollButtons orientation="horizontal"> | ||
<Tab label="Tab A" /> | ||
<Tab label="Tab B" /> | ||
<Tab label="Tab C" /> | ||
<Tab label="Tab D" /> | ||
<Tab label="Tab E" /> | ||
<Tab label="Tab F" /> | ||
<Tab label="Tab G" /> | ||
</Tabs> | ||
</Box> | ||
</ThemeProvider> | ||
</CacheProvider> | ||
</StyleSheetManager> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider the similar
size
like here if left-side button is out of view as well, in the earlier above if condition?