[TabScrollButton] Fix StartScrollButtonIcon/EndScrollButtonIcon swap in RTL#48502
Open
starboyvarun wants to merge 1 commit intomui:masterfrom
Open
[TabScrollButton] Fix StartScrollButtonIcon/EndScrollButtonIcon swap in RTL#48502starboyvarun wants to merge 1 commit intomui:masterfrom
starboyvarun wants to merge 1 commit intomui:masterfrom
Conversation
…in RTL (mui#39296) In RTL layout, Tabs.js passes `direction=right` to the start scroll button and `direction=left` to the end scroll button (flipped from LTR). However, TabScrollButton chose which slot icon to render based solely on `direction`, without accounting for the RTL flip. This caused custom `StartScrollButtonIcon` and `EndScrollButtonIcon` slot overrides to appear on the wrong sides in RTL. Fix: use `(direction === left) !== isRtl` to select the icon slot so that in RTL the semantic start/end mapping follows the visual flip applied by Tabs.
Deploy previewhttps://deploy-preview-48502--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
mj12albert
requested changes
May 8, 2026
Member
mj12albert
left a comment
There was a problem hiding this comment.
This breaks vertical orientation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #39296.
In RTL layout,
Tabs.jspassesdirection="right"to the start scroll button anddirection="left"to the end scroll button (the directions are flipped so the arrows point the right way visually). However,TabScrollButtonselected which slot icon to render based solely ondirection === 'left'with no awareness of RTL. This caused customStartScrollButtonIconandEndScrollButtonIconslot overrides to appear on the wrong sides in RTL mode.Fix: Change the icon selection to
(direction === 'left') !== isRtl. This XOR keeps LTR behavior identical and inverts the slot mapping in RTL soStartScrollButtonIconalways renders in the start scroll button andEndScrollButtonIconalways renders in the end scroll button, regardless of direction.Test plan
StartScrollButtonIconrenders fordirection="right"in RTLEndScrollButtonIconrenders fordirection="left"in RTL