Repository navigation
fix(rtl): use :dir() for rtl styles when the browser supports it - #31744
Draft
brandyscarney wants to merge 1 commit into
Draft
brandyscarney wants to merge 1 commit into
brandyscarney wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The rtl mixin output a :host-context([dir=rtl]) selector for Chromium alongside :dir(rtl). :host-context() matches any ancestor with dir="rtl", so an LTR section inside an RTL page got the RTL styles in Chromium, such as a popover arrow pointing away from its trigger. :host-context() is now only a fallback for browsers without :dir() support, so Chrome 120+ follows the nearest dir like Firefox and Safari.
brandyscarney
force-pushed
the
FW-7850
branch
from
November 12, 2026 19:49
2b20e88 to
3b98571
Compare
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.
Issue number: internal
What is the current behavior?
The
rtl()mixin outputs a:host-context([dir=rtl])selector for Chromium alongside a:dir(rtl)selector for Firefox and Safari.:host-context([dir=rtl])matches any ancestor withdir="rtl", even when a closer ancestor setsdir="ltr". In Chromium, an LTR section inside an RTL page gets the RTL styles from every shadow component that uses the RTL mixins.This is visible in the popover position test: in "LTR, Start" in
popover-position-ios-rtl-Mobile-Chrome-linux.png, the arrow points away from its trigger. Firefox and Safari already render it correctly because they only use:dir().What is the new behavior?
:host-context()selectors are now only output inside@supports not selector(:dir(rtl)), so browsers that support:dir()use it exclusively.:dir()follows the nearest ancestor with adirattribute.:host-context()fallback, so their behavior does not change.popover/test/position(ios, rtl), where the "LTR, Start" arrow now points at its trigger.Does this introduce a breaking change?
Other information
:host-context()rules in@supports not selector(:dir(rtl)), and nothing else. Global stylesheets are unchanged.alignmentissue on that ticket is calculated in JavaScript inpopover/utils.tsand is not part of this PR.