Skip to content

fix(calendar): mirror month navigation chevrons in RTL#3482

Open
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:fix/3388-calendar-rtl-arrows
Open

fix(calendar): mirror month navigation chevrons in RTL#3482
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:fix/3388-calendar-rtl-arrows

Conversation

@AKnassa

@AKnassa AKnassa commented Jul 3, 2026

Copy link
Copy Markdown

What this does

Makes the calendar's month arrows point the right way for right-to-left languages (Arabic, Hebrew). Before, both arrows pointed inward at the month name; now they point outward, the way every calendar should.

Why

Anyone using the calendar in an RTL page saw backwards-looking arrows — confusing, and it made the product feel broken in those languages.

Fixes #3388

What changed

  • The two arrow icons in the calendar header now flip automatically when the page direction is right-to-left. It's a pure CSS flip (same approach MobileNav already uses) — nothing about the buttons' order, labels, or behavior changed.
  • The date pickers (DateInput, DateRangeInput, DateTimeInput) use this same calendar inside their popovers, so they're fixed too.
  • Added tests, an RTL Storybook story, and a changeset.

How to see it

fix

Run Storybook and open Core/Calendar → RTL: the header should read ‹ January 2026 › with "Previous month" on the right. Compare with the Default story to confirm left-to-right looks exactly as before.

Good to know (scope)

  • The flip responds to the standard dir="rtl" attribute (the same trade-off MobileNav made). Setting only the CSS direction property won't trigger it.
  • Known related-but-separate issues, deliberately not in this PR: arrow-key navigation inside the day grid is also inverted in RTL (needs a JS fix in a shared hook), and Pagination/Lightbox/Carousel/SideNav/TreeList have the same chevron problem (Lightbox and Carousel need more than an icon flip). Follow-up issues coming.

Under dir="rtl" the flex header swaps the nav buttons' visual sides but
the hardcoded chevronLeft/chevronRight glyphs kept pointing inward at
the month label. Mirror them with a CSS-only StyleX conditional
transform (scaleX(-1) keyed on ':is([dir="rtl"] *)', same pattern as
MobileNav) on a wrapper span — Icon's string mode clobbers caller
classNames, so the style cannot go on Icon itself. DOM order, labels,
and handlers unchanged; also fixes the embedded calendars in DateInput,
DateRangeInput, and DateTimeInput.
@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

@AKnassa is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 3, 2026
@AKnassa AKnassa marked this pull request as ready for review July 3, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] month navigation arrows look wrong in RTL

1 participant