[tabs] Fix indicator positioning inside transformed wrappers - #5601
Draft
atomiks wants to merge 1 commit into
Draft
[tabs] Fix indicator positioning inside transformed wrappers#5601atomiks wants to merge 1 commit into
atomiks wants to merge 1 commit into
Conversation
commit: |
Bundle size
PerformanceTotal duration: 967.04 ms -81.29 ms(-7.8%) | Renders: 76 (+0) | Paint: 1,555.21 ms -127.94 ms(-7.6%)
14 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
The indicator only compensated for the active tab's own translation. A translated wrapper between the tab and the list (a common shape for per-tab motion wrappers) made the rect and layout offsets disagree, so the indicator fell back to the tab's static layout slot and ignored the motion. The prehydration script had the same blind spot and painted at the wrong position before hydration moved it.
Changes
getActiveTabTranslation/resolveTranslateLength) withhasDistortingTransform, which walks the ancestor chain and keeps the precise rect-based offset unless it finds a transform the rect math cannot undo: rotation, skew, flip, perspective, or a scale not shared with the list. Pure translations anywhere in the chain now work, includingcalc()values in thetranslatelonghand, which the old parser gave up on.scaleX/scaleYdivision already cancels it. Tab-local scale falls back to layout offsets, which keeps the indicator centered on the tab's slot.getComputedStylereads. The walk only runs when the offsets disagree.DOMMatrixReadOnly(jsdom) fall back to layout offsets.