Skip to content

fix(mobile): open the folder drawer from the right in RTL - #944

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/rtl-mobile-drawer-side
Open

fix(mobile): open the folder drawer from the right in RTL#944
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/rtl-mobile-drawer-side

Conversation

@shukiv

@shukiv shukiv commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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-0start-0 (logical inset-inline-start), in both the embedded and the fixed-overlay branch.
  • Pair the translate with an rtl: override. translate-x is 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:

.max-lg\:-translate-x-full      @ 144868
.max-lg\:rtl\:translate-x-full  @ 154037   <- wins

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 --noEmit clean on this branch.
  • Built and deployed to a production instance; confirmed all three rules present and correctly ordered in the served CSS.
  • LTR behaviour unchanged — the negative translate and its max-lg: variant are untouched.

Desktop is unaffected (lg:relative lg:translate-x-0, normal flex flow).

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().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant