Repository navigation
fix(core): position popovers manually under a transformed ancestor - #9762
Merged
sampotts merged 2 commits intoNov 18, 2026
Merged
Conversation
Firefox resolves CSS anchor() against the anchor's untransformed box, while the cross-axis clamp is built from getBoundingClientRect(), which includes transforms. Under a transformed ancestor the popup lands away from its trigger. Use the rect-based manual path there, and clear the properties only the anchor path sets when switching to it. Fixes videojs#9752
👷 Deploy request for vjs10-site pending review.Visit the deploys page to approve it
|
👷 Deploy request for vjs-registry pending review.Visit the deploys page to approve it
|
|
@vladosskins178 is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Claude review: no high-confidence bugs found. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
spuppo-mux
approved these changes
Nov 16, 2026
Collaborator
|
Thanks for the thorough write-up and the before-and-after measurements, @vladosskins178. This looks good to merge. Falling back to the rect-based path keeps every value in one coordinate system, and the property resets cover switching back from an earlier anchor position. Two non-blocking notes for follow-up, not this PR:
|
sampotts
approved these changes
Nov 18, 2026
Contributor
|
Claude review: no high-confidence bugs found. |
Merged
This branch was successfully deployed
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.
Fixes #9752
What
Under a transformed ancestor,
PopupPositionernow uses the rect-based manual path even where CSS anchor positioning is supported (option 1 from the issue). Everything in the style then comes fromgetBoundingClientRect(), so both parts agree.positioning.ts: newhasTransformedAncestor(element). It walks the flat tree (walkAncestorswithcomposed: true, so it crosses the skin's shadow root) and checkstransform,translate,scale,rotateandperspective. The trigger's own transform is skipped, so a pressed or animated button doesn't switch modes.getAnchorPositionStyle()takes an optionaluseAnchorPositioningargument (default:supportsAnchorPositioning()). When the manual path runs in a browser that supports anchor positioning, it also resetstranslate,justify-self,align-self,margin-inline-startandmargin-block-start.applyStyles()never removes properties, so values from an earlier anchor position would otherwise stay on the popup. Browsers without anchor support get exactly the same styles as before.positioner.ts:anchorSupported = supportsAnchorPositioning() && !hasTransformedAncestor(trigger). This same flag also picks the containing-block origin and the popup rect, as it already did for the fallback.Without a transformed ancestor, nothing changes in any browser.
Testing
Reproduced first with the CDN build (
pnpm build:packages && pnpm build:cdn) and the default video skin inside<div style="position:absolute; left:50%; top:50%; width:640px; transform:translate(-50%,-50%)">at 1440×900. Playwright drove headed Firefox 148.0.2 (under Xvfb, because headless Firefox reportshover: none) and Chromium. Positions are the left/top of the trigger and the popup:Without the transform, Firefox and Chromium give the same positions before and after the change.
Unit tests:
positioning.test.ts:hasTransformedAncestor(ancestor transform, the element's own transform ignored, across a shadow root), plus the manual path with anchor support turned off (noanchor()values, anchor-only properties reset).positioner.test.ts: with anchor support, a trigger getsanchor()styles. After its wrapper gets a transform, the next sync gives manual coordinates andtranslate: none.CSS.supportsis stubbed, so there is no module mock.Ran:
vp test runin core (1709 passed), html (526) and react (695), pluspnpm typecheckandpnpm lint. I ran all of it again from a fresh clone of the branch, along with the Firefox/Chromium measurements above.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.