fix(mobile): open the folder drawer from the right in RTL - #944
Open
shukiv wants to merge 1 commit into
Open
Conversation
The mobile/tablet sidebar was pinned with physical direction utilities — left-0 and -translate-x-full — which do not flip under dir="rtl". In Hebrew the drawer therefore anchored to the left edge and slid in from the left, away from the hamburger button that opens it. Use the logical start-0 for the inset, and pair the physical translate with an rtl: override, since translate-x has no logical equivalent. The RTL rule is emitted after the LTR one, so it wins the cascade despite Tailwind wrapping rtl: in a zero-specificity :where().
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.
Problem
On mobile and tablet in an RTL locale, tapping the hamburger opens the folder drawer from the left edge — the opposite side from the button that opens it. Reported by a Hebrew user; reproduced at
dir="rtl"on any narrow viewport.Cause
The sidebar container is pinned with physical direction utilities that don't respond to
dir:left-0/max-lg:left-0— anchors to the physical left in both directions-translate-x-full/max-lg:-translate-x-full— slides off to the physical left<html dir>is already set correctly from the locale; only these classes ignore it.Fix
left-0→start-0(logicalinset-inline-start), in both the embedded and the fixed-overlay branch.rtl:override.translate-xis physical and Tailwind has no logical equivalent, so the sign has to be flipped explicitly rather than swapped for a logical utility.Worth noting for review: Tailwind v4 emits
rtl:wrapped in:where(…), which contributes zero specificity. The override therefore wins on source order alone. I verified in the built stylesheet that the RTL rule is emitted after the LTR one:The generated selector matches
:lang(he)as well as[dir=rtl], so it applies whether direction comes from the attribute or the language.Testing
tsc --noEmitclean on this branch.max-lg:variant are untouched.Desktop is unaffected (
lg:relative lg:translate-x-0, normal flex flow).