You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[tabs] Wrong position of indicator & width when using transform:scale. #35631
If you have a question on Stack Overflow, you are welcome to link to it here, it might help others.
If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.
@ZeeshanTamboli You removed the scaled div, of course it'll work when you remove the parent scale.
@madmonliadd Sorry for that, I didn't read carefully about you saying Wrap the tabs component with a transform:scaled wrapper.
I don't know why you want to achieve scaling for your use case, but you can increase the scaling by directly applying the styles to the AppBar. Having a unnecessary div in between for scaling is causing the issue of moving the position of the tab indicator. As for the width, it is calculated dynamically under the hood according to the size of the tab and considers various other factors, but you can override it with the .MuiTabs-indicator class if you want to or instead calculate it as per the scaling and apply it.
@ZeeshanTamboli Hey, thanks for your help, I tried stack overflow without success, it's a bug, not a help request.
Your codesandbox didn't solve the issue, click other tabs and see how the position of the indicator is incorrect, it's not directly under the selected tab.
It's not a bug. It's just about overriding with the correct styles.
You have to simply find a way to style the tab indicator properly. Maybe you want to check if you are correctly using transform: scale property. You may not want to scale the indicator or maybe you shouldn't use the scale on tabs in the first place and use sizing. Take a look at the customization of Tabs docs: https://mui.com/material-ui/react-tabs/#customization
In case someone else lands here.
I faced this problem in an app where scaling a parent container was not up to me.
I could fix it by overriding left style of indicator like below. In my case the fixed values worked.
@ZeeshanTamboli
I see the exact same issue, and it seems like a bug, as opposed to what was said.
The indicator does not follow the button size if scaling is applied to a parent div.
In the video below no special handling is applied to the buttons, and they keep their size just fine with parent scaling. The selector should just do the same.
In my case, the parent container is scaled due to the canvas zoom. I would expect the indicators to follow the size of the button without me needing to "override with the correct styles."
Screencast.From.2026-09-03.20-38-46.webm
PS: I am able to reproduce this even on MUI docs by setting transform: "scale(1.2)", transformOrigin: "top left" in any of the parent Boxes of the tab examples in here.
changed the title [-]Tabs indicator wrong position & width when using transform:scale.[/-][+][tabs] Wrong position of indicator & width when using transform:scale.[/+]on Sep 30, 2026
I investigated this on the current master and was able to reproduce it.
The indicator calculation currently mixes transformed viewport measurements from getBoundingClientRect() with local scroller coordinates. With a scaled ancestor, the resulting left/width values already include the scale and are then scaled again when the indicator is rendered.
I have a small fix that normalizes those measurements back to the scroller's local coordinate space before calculating the indicator position/size, while preserving the existing sub-pixel behavior when no transform is present.
I'd be happy to open a PR with regression coverage for this.
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@madmonliadd Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.
Activity
ZeeshanTamboli commentedon Dec 27, 2022
You need to target the
indicatorclass onTabsto style the tabs indicator. See the updated CodeSandbox: https://codesandbox.io/s/usage-forked-l1m7fu?file=/index.jsgithub-actions commentedon Dec 27, 2022
👋 Thanks for using MUI Core!
We use GitHub issues exclusively as a bug and feature requests tracker, however,
this issue appears to be a support request.
For support, please check out https://mui.com/getting-started/support/. Thanks!
If you have a question on Stack Overflow, you are welcome to link to it here, it might help others.
If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.
madmonliadd commentedon Dec 27, 2022
@ZeeshanTamboli You removed the scaled div, of course it'll work when you remove the parent scale.
ZeeshanTamboli commentedon Dec 27, 2022
@madmonliadd Sorry for that, I didn't read carefully about you saying
Wrap the tabs component with a transform:scaled wrapper.I don't know why you want to achieve scaling for your use case, but you can increase the scaling by directly applying the styles to the AppBar. Having a unnecessary div in between for scaling is causing the issue of moving the position of the tab indicator. As for the width, it is calculated dynamically under the hood according to the size of the tab and considers various other factors, but you can override it with the
.MuiTabs-indicatorclass if you want to or instead calculate it as per the scaling and apply it.See the updated CodeSandbox: https://codesandbox.io/s/usage-forked-1y7g9f?file=/index.js
I would suggest to use StackOverflow for these type of questions.
I hope it helps.
madmonliadd commentedon Dec 27, 2022
@ZeeshanTamboli Hey, thanks for your help, I tried stack overflow without success, it's a bug, not a help request.
Your codesandbox didn't solve the issue, click other tabs and see how the position of the indicator is incorrect, it's not directly under the selected tab.
ZeeshanTamboli commentedon Dec 27, 2022
It's not a bug. It's just about overriding with the correct styles.
You have to simply find a way to style the tab indicator properly. Maybe you want to check if you are correctly using
transform: scaleproperty. You may not want to scale the indicator or maybe you shouldn't use the scale on tabs in the first place and use sizing. Take a look at the customization of Tabs docs: https://mui.com/material-ui/react-tabs/#customizationcarmenchapa commentedon Feb 7, 2025
In case someone else lands here.
I faced this problem in an app where scaling a parent container was not up to me.
I could fix it by overriding left style of indicator like below. In my case the fixed values worked.
AndreFavotto commentedon Sep 3, 2026
@ZeeshanTamboli
I see the exact same issue, and it seems like a bug, as opposed to what was said.
The indicator does not follow the button size if scaling is applied to a parent div.
In the video below no special handling is applied to the buttons, and they keep their size just fine with parent scaling. The selector should just do the same.
In my case, the parent container is scaled due to the canvas zoom. I would expect the indicators to follow the size of the button without me needing to "override with the correct styles."
Screencast.From.2026-09-03.20-38-46.webm
PS: I am able to reproduce this even on MUI docs by setting
transform: "scale(1.2)", transformOrigin: "top left"in any of the parent Boxes of the tab examples in here.Workaround MUI Tabs indicator transform
ZeeshanTamboli commentedon Sep 30, 2026
I will re-open this and mark it as a bug. The Tabs indicator should follow the Button size as mentioned above.
[-]Tabs indicator wrong position & width when using transform:scale.[/-][+][tabs] Wrong position of indicator & width when using transform:scale.[/+]maricastroc commentedon Sep 30, 2026
I investigated this on the current
masterand was able to reproduce it.The indicator calculation currently mixes transformed viewport measurements from
getBoundingClientRect()with local scroller coordinates. With a scaled ancestor, the resultingleft/widthvalues already include the scale and are then scaled again when the indicator is rendered.I have a small fix that normalizes those measurements back to the scroller's local coordinate space before calculating the indicator position/size, while preserving the existing sub-pixel behavior when no transform is present.
I'd be happy to open a PR with regression coverage for this.
github-actions commentedon Oct 14, 2026
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@madmonliadd Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.