Skip to content

fix(dropdown-menu): flip submenu chevrons by the nearest dir, not any RTL ancestor - #13685

Merged
cixzhang merged 6 commits into
meta:mainfrom
wbaha:fix/dropdown-submenu-chevron-local-direction
Nov 24, 2026
Merged

cixzhang merged 6 commits into
meta:mainfrom
wbaha:fix/dropdown-submenu-chevron-local-direction

Conversation

@wbaha

@wbaha wbaha commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13655

User impact

Users of a DropdownMenu with a flyout sub-menu where the menu's dir differs from the page's, and the menu renders inside its dir region: an LTR menu inside an RTL page. The "Move to" chevron points left, ArrowRight opens the flyout, and the flyout appears on the right. The icon contradicts the key and the flyout side.

Problem and solution fit

  • The sub-menu row's chevron and the drill-in Back chevron used rtlStyles.mirror. It flips for any [dir="rtl"] ancestor.
  • The open and close keys read the menu's own computed direction, and the flyout opens on the side that direction gives.
  • So the icon follows the document and the key follows the menu. They disagree when the two directions differ.
  • A chevron that points away from where the flyout opens misleads a user about what the row does.

Expected behavior and authority

docs/design/bidirectionality.md DR6: interaction follows the visual relationship. The chevron, the opening key and the flyout side must agree. The issue cites DR4 and DR6.

Smallest restoration

The two chevrons flip with :dir(rtl), which follows the nearest dir. For a menu inside its dir region, that is the same direction the key handler reads. The style lives in a new menuDirectionMirror.stylex.ts next to the other DropdownMenu StyleX helpers. menuRowCorners.stylex.ts already uses :dir(rtl) in this folder.

rtlStyles.mirror is shared by 28 files and its header documents its [dir="rtl"] behavior, so it is unchanged. No new public API.

Evidence

Real Chromium 149 (Playwright), sub-menu row "Move to", flyout opened with the local opening key:

Document Menu Chevron flipped, before Chevron flipped, after Flyout opens
ltr ltr no no right
rtl ltr yes (wrong) no right
rtl rtl yes yes left
ltr rtl yes yes left
  • Reproduction before the change: the second row, on current main (04f0e4b).
  • Result after the change: the chevron is flipped only when the menu is RTL, so it matches the flyout side in all four rows.
  • Representative unchanged path: rows 1, 3 and 4 behave as before.
  • Regression test or other mutation-sensitive proof: DropdownMenuSubMenu.test.tsx asserts the computed transform of the flyout chevron (menu RTL, and local LTR menu inside an RTL document) and of the drill-in Back icon in three direction cases. Restoring the old rtlStyles.mirror fails the nested-LTR flyout test and the nested-LTR Back icon test.

Scope

Components: DropdownMenu

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run packages/core/src/DropdownMenu packages/core/src/ContextMenu: 24 files, 524 tests pass.
  • tsc --noEmit in packages/core, ESLint and Prettier on the changed files: clean.
  • Pre-commit checks (changeset, knowledge records, package boundaries): pass.
  • The browser table covers the flyout chevron. The drill-in Back icon uses the same style and is covered by the computed-transform tests above, not by a browser check.
  • Out of scope: a menu whose trigger sits in an element the layer treats as unsafe, for example <ul dir="ltr"><li> in an RTL page. The layer portals the menu out and copies only the CSS direction, not dir (useLayer.tsx), so :dir(rtl) follows the page there. Measured in Chromium 149 on an RTL page with an LTR menu: inside <div dir="ltr"> the chevron is not flipped (fixed). Inside <ul dir="ltr"><li> and <p dir="ltr"> the popover has an inline direction: ltr and no dir, the chevron is still flipped, and the flyout opens on the right (unchanged from before). Carrying dir through the layer would change every popover, so it needs its own change.
  • Out of scope: the bottom-sheet presentation's chevrons (DropdownMenu.tsx, MenuBottomSheetActionList.tsx, ContextMenu.tsx) still use rtlStyles.mirror. They can follow in a separate change.

Follow-up: #13691 (two optional wording notes from review).

Known trade-off tracked in #13695 (an RTL menu inside an LTR region of an RTL page).

The flyout chevron and the drill-in Back chevron flipped by the nearest
[dir="rtl"] ancestor, while the opening key and the flyout side follow
the menu's own direction. In a local LTR menu inside an RTL document the
chevron pointed left and the flyout opened on the right. Flip them with
:dir(rtl) so all three agree.
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 24, 2026 4:41am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 23, 2026
@astracat-bot

astracat-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 24, 2026, 4:49 AM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Nov 23, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. The chevron fix itself is right: in Chromium the flyout chevron and the drill-in Back chevron now match the menu's own direction, and an RTL menu renders exactly as before.

  • The description says jsdom does not evaluate :dir(), but this repository's Vitest setup injects the StyleX rules and jsdom applies them (for an LTR menu inside an RTL region the indicator's computed transform is scaleX(-1) with the old component and empty with this change), so please assert the computed transform in both RTL tests in DropdownMenuSubMenu.test.tsx instead of StyleX class names, ideally cover the drill-in Back icon the same way, and correct that sentence.

Non-blocking: the bottom-sheet presentation's chevrons in DropdownMenu.tsx, MenuBottomSheetActionList.tsx and ContextMenu.tsx still mirror for any RTL ancestor, which could be a follow-up, and the header comment in menuDirectionMirror.stylex.ts could be tightened (see the inline note). CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Release note: the flyout row chevron and the drill-in Back chevron follow the menu's own direction. Verified (DropdownMenuSubMenu.tsx:1141, :1168; Chromium probe).
  • Release note: before, an LTR menu inside an RTL page showed a left-pointing chevron while ArrowRight opened the flyout on the right. Verified (Chromium, base).
  • Release note: the chevron now points right, so icon, key and flyout side agree. Verified (Chromium, head).
  • Release note: a menu that is itself RTL is unchanged. Verified (pixel-identical before and after frames).
  • Description: the chevrons used an ancestor-attribute mirror while the keys read the menu's computed direction. Verified (rtlStyles.ts:31; DropdownMenuSubMenu.tsx:957-961, :1051-1055).
  • Description: :dir(rtl) reads the same direction as the key handler. Verified when direction comes from dir, as the bidirectionality guide requires; CSS direction alone differs, as it did before.
  • Description: another style in the folder already uses :dir(rtl). Verified (menuRowCorners.stylex.ts).
  • Description: the shared mirror has 28 users, stays unchanged, and there is no new public API. Verified (28 non-test Core files; API surface comparison shows no change).
  • Description: the four-row before/after table. Rows 2 and 3 verified in Chromium; rows 1 and 4 follow from the two selectors.
  • Description: the new test fails when the old mirror is restored. Verified (two tests fail with the old component).
  • Description: jsdom does not evaluate :dir(). False (the computed transform differs between the old and new component in jsdom).
  • Description: 24 test files and 521 tests pass. Verified.
  • Description: typecheck, ESLint, Prettier and the pre-commit checks pass. Verified (Core typecheck, ESLint, Prettier, changeset, knowledge and package-boundary checks).
  • Description: the Back chevron was not browser-checked. Now checked in Chromium: it points left in an LTR menu inside an RTL page.
  • File .changeset/dropdown-submenu-chevron-local-direction.md: clear.
  • File packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear.
  • File packages/core/src/DropdownMenu/menuDirectionMirror.stylex.ts: clear, with a non-blocking comment-wording note.
  • File packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: blocking finding (class-name assertions).

Automated review (maintainer link)

Check the computed transform of the flyout chevron instead of StyleX
class names, and cover the drill-in Back icon the same way. Tighten the
header comment of the direction mirror style.
@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-rtl Run the RTL suite on this PR; write access, next push (AST-030 FR12) labels Nov 23, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec e3a864a

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. The chevron fix works for a menu that renders inside its dir element, and the earlier test request is resolved: both RTL tests now assert the computed transform, and the drill-in Back icon is covered.

  • Miss: the changeset and description say both chevrons now follow the menu's own direction and that :dir(rtl) reads the same direction as the key handler, but a menu whose trigger sits in an element the layer treats as unsafe (for example <ul dir="ltr"><li> in an RTL page) is portaled out of that element with only CSS direction copied, so in Chromium its chevron still points left while ArrowRight opens the flyout on the right; please narrow the changeset, title, description and the header comment in menuDirectionMirror.stylex.ts to menus that render inside their dir region (the old selector also matched any RTL ancestor, not the nearest), or make the portaled layer carry the dir it leaves and add a test for that mount.

The inline comments suggest wording for the changeset and the header comment.

Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Before the change, an LTR menu inside an RTL page showed a left-pointing chevron while ArrowRight opened the flyout on the right: verified in Chromium against the base.
  • The two chevrons used rtlStyles.mirror, which flips for any RTL ancestor: verified (utils/rtlStyles.ts:31).
  • The open and close keys read the menu's computed direction, and the flyout opens on that side: verified (DropdownMenuSubMenu.tsx:957-961, :1051-1055; Chromium).
  • :dir(rtl) reads the same direction as the key handler: false for a menu the layer portals out of its dir element (Layer/useLayer.tsx:1218; Chromium <ul dir="ltr"> mount).
  • menuRowCorners.stylex.ts already uses :dir(rtl) in this folder: verified (menuRowCorners.stylex.ts:23).
  • rtlStyles.mirror is shared by 28 files and its header documents its behavior: verified (28 files under packages/core/src; rtlStyles.ts:14-17).
  • No new public API: verified (API surface comparison of base and head lists no change).
  • The four-row direction table: rows 2 and 3 verified in Chromium; rows 1 and 4 verified by code and by the Back icon test cases.
  • Restoring the old style fails the nested-LTR flyout test and the nested-LTR Back icon test: verified (exactly those two fail against the base component).
  • The DropdownMenu and ContextMenu suites pass (24 files, 524 tests): verified.
  • TypeScript, ESLint and Prettier are clean on the changed files: verified.
  • Changeset, knowledge-record and package-boundary checks pass: verified.
  • The bottom-sheet chevrons still use rtlStyles.mirror and are out of scope: verified (DropdownMenu.tsx:893, MenuBottomSheetActionList.tsx:198, ContextMenu.tsx:917).
  • Changeset: the chevrons now follow the menu's own direction instead of the nearest RTL ancestor: false (portaled mount; the old selector matches any RTL ancestor).
  • Changeset: the chevron used to point left and now points right, so icon, key and flyout side agree: verified for a menu inside <div dir="ltr">, false for the portaled mount.
  • Changeset: a menu that is itself RTL is unchanged: verified (pixel-identical frames).
  • Public text contains no internal context: verified.

Files:

  • .changeset/dropdown-submenu-chevron-local-direction.md: finding (claim scope).
  • packages/core/src/DropdownMenu/menuDirectionMirror.stylex.ts: finding (header comment repeats the claim).
  • packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear.
  • packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear (a portaled-mount case belongs to the fix above if the claim stays broad).

Automated review (maintainer link)

…r region

A layer that portals a menu out of an unsafe ancestor copies only the CSS
direction, not dir, so :dir(rtl) does not follow it there. Say so in the
changeset and in the header comment of the direction mirror style.
@wbaha wbaha changed the title fix(dropdown-menu): follow the menu's own direction for submenu chevrons fix(dropdown-menu): flip submenu chevrons by the nearest dir, not any RTL ancestor Nov 23, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 0f8c39d

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, so the next step is a maintainer adding the ci:run label. Both chevrons now follow the nearest dir, and the changeset and header comment now limit the fix to a menu that renders inside its dir region, which resolves the earlier request.

Two optional suggestions, also left inline:

  • The changeset's last sentence could read "An RTL menu inside its dir region is unchanged", since one portaled layout (an RTL list inside an LTR region of an RTL page) now loses its mirror.
  • The style's header could shrink to about 12 lines, with @output saying "the nearest dir" to match the prose.
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Before the change, an LTR menu in an RTL page showed a left-pointing chevron while ArrowRight opened the flyout on the right: verified (Chromium frame on the base; utils/rtlStyles.ts:31).
  • Both chevrons used the shared mirror style, which flips under any RTL ancestor: verified (utils/rtlStyles.ts:31).
  • The open and close keys read the menu's computed direction, and the flyout opens on that side: verified (DropdownMenuSubMenu.tsx:957-961, :1051-1055; Chromium frames).
  • The chevrons now flip with :dir(rtl), which follows the nearest dir and, for a menu inside its dir region, matches the key handler: verified (menuDirectionMirror.stylex.ts:23, DropdownMenuSubMenu.tsx:1141, :1168).
  • The folder already uses :dir(rtl) in its row-corner styles: verified (menuRowCorners.stylex.ts:25).
  • The shared mirror style is used by 28 files and its header documents its behavior, so it stays unchanged: verified (28 files under packages/core/src at the base; utils/rtlStyles.ts:14-17).
  • No new public API: verified (no export, prop, default or theme target changes; the new style is imported only by DropdownMenuSubMenu.tsx).
  • The four-row Chromium table: rows 2 and 3 verified by Chromium frames, rows 1 and 4 by code and the Back icon test cases.
  • The tests assert the computed transform, and restoring the old style fails exactly the nested-LTR flyout and Back icon tests: verified (DropdownMenuSubMenu.test.tsx:208-269, :1724-1758).
  • The DropdownMenu and ContextMenu suites pass (24 files, 524 tests), and TypeScript, ESLint, Prettier and the pre-commit checks are clean: verified; the code they cover is unchanged since the previous push apart from comments and the release note.
  • A menu inside a list item or paragraph with its own dir is portaled with CSS direction only and keeps the old chevron: verified (Layer/useLayer.tsx:1216-1218; Chromium list-item frames identical before and after).
  • The bottom-sheet chevrons still use the shared style and are out of scope: verified (DropdownMenu.tsx:893, MenuBottomSheetActionList.tsx:198, ContextMenu.tsx:917).
  • Public text carries no internal context: verified.
  • Changeset: both chevrons now flip by the nearest dir instead of any RTL ancestor: verified.
  • Changeset: in an LTR menu inside an RTL page the chevron now points right, so icon, key and flyout side agree: verified for a menu inside its dir region, the case the changeset names as covered.
  • Changeset: a menu the layer portals out of an unsafe host is not covered: verified.
  • Changeset: an RTL menu is unchanged: verified for a menu inside its dir region; one portaled layout changes (suggestion above).
  • Changeset: a patch release of the core package: verified (a fix).

Files:

  • .changeset/dropdown-submenu-chevron-local-direction.md: clear (optional wording suggestion).
  • packages/core/src/DropdownMenu/menuDirectionMirror.stylex.ts: clear (optional header suggestion).
  • packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear.
  • packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear.

Automated review (maintainer link)

Comment on lines +3 to +17
/**
* @file menuDirectionMirror.stylex.ts
* @input None
* @output Exports menuDirectionMirror: a StyleX style that flips an icon when
* the menu's own direction is right-to-left
* @position Used by the sub-menu row's flyout chevron and its Back chevron
*
* The open and close keys read the menu's own direction. `:dir(rtl)`
* follows the nearest `dir`. `rtlStyles.mirror` matches any RTL ancestor, so
* it flips the icon in an LTR menu inside an RTL page.
*
* This holds for a menu that renders inside its `dir` region. A layer that
* portals out of an unsafe ancestor copies only the CSS direction, not `dir`.
* This style does not follow that copy.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional (comment style): the header runs 15 lines, past the file header's usual 12, and @output says "the menu's own direction" while the prose says the nearest dir. A shorter header that keeps the reason and the constraint:

/**
 * @file menuDirectionMirror.stylex.ts
 * @input None
 * @output menuDirectionMirror: flips an icon when the nearest `dir` is RTL
 * @position Used by the sub-menu row's flyout chevron and its Back chevron
 *
 * `rtlStyles.mirror` matches any RTL ancestor, so it flips the icon in an LTR
 * menu inside an RTL page. A layer portaled out of an unsafe host keeps only
 * CSS `direction`, not `dir`, so this style does not follow it.
 */

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 23, 2026
@cixzhang
cixzhang marked this pull request as draft November 23, 2026 22:46
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 23, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec a7d78aa

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The pull request is a draft and already carries the ci:run label, so marking it ready for review starts its run. The newest commit only merges main, which changes no code the chevrons use, so the fix still restores the menu's RTL behavior for a menu that renders inside its dir region.

Two optional suggestions, already left inline and tracked in #13691:

  • The changeset's last sentence could read "An RTL menu inside its dir region is unchanged", since one portaled layout (an RTL list inside an LTR region of an RTL page, #13695) now loses its mirror.
  • The style's header could shrink to about 12 lines, with @output saying "the nearest dir" to match the prose.
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Before the change, an LTR menu in an RTL page showed a left-pointing chevron while ArrowRight opened the flyout on the right: verified (Chromium frame of the base; utils/rtlStyles.ts:31).
  • Both chevrons used the shared mirror style, which flips under any RTL ancestor: verified (utils/rtlStyles.ts:31).
  • The open and close keys read the menu's computed direction, and the flyout opens on that side: verified (DropdownMenuSubMenu.tsx:957-961, :1051-1055; Chromium frames).
  • The bidirectionality guide asks the chevron, the opening key and the flyout side to agree: verified (its interaction rule on side placement and its rule on nested regions).
  • The chevrons now flip with :dir(rtl), which follows the nearest dir and, for a menu inside its dir region, matches the key handler: verified (menuDirectionMirror.stylex.ts:23, DropdownMenuSubMenu.tsx:1141, :1168).
  • The new style sits beside the folder's other StyleX helpers, and the folder already uses :dir(rtl) in its row-corner styles: verified (menuRowCorners.stylex.ts:24-25).
  • The shared mirror style is used by 28 files and its header documents its behavior, so it stays unchanged: verified (28 files under packages/core/src at the base; utils/rtlStyles.ts:14-17).
  • No new public API: verified (no export, prop, default or theme target changes; the new style is imported only by DropdownMenuSubMenu.tsx).
  • The four-row Chromium table, including the reproduction on main in its second row: rows 2 and 3 verified by Chromium frames, rows 1 and 4 by code and the Back icon test cases.
  • The tests assert the computed transform, and restoring the old style fails exactly the nested-LTR flyout and Back icon tests: verified (DropdownMenuSubMenu.test.tsx:208-269, :1741-1775; a red-first run on identical component code).
  • The DropdownMenu and ContextMenu suites pass (24 files, 524 tests), and TypeScript, ESLint, Prettier and the pre-commit checks are clean: verified before the merge of main; not rerun on this head, whose suites now include tests main added.
  • The browser table covers the flyout chevron, and the Back icon is covered by the computed-transform tests: verified.
  • A menu inside a list item or paragraph with its own dir is portaled with CSS direction only and keeps the old chevron: verified (Layer/useLayer.tsx:1216-1219, Layer/layerHost.ts:162; Chromium list-item frames identical before and after).
  • The bottom-sheet chevrons still use the shared style and are out of scope: verified (DropdownMenu.tsx:893, MenuBottomSheetActionList.tsx:198, ContextMenu.tsx:917).
  • Public text carries no internal context: verified.
  • The two optional wording notes are tracked in a follow-up issue: verified (#13691 is open).
  • The trade-off for an RTL menu inside an LTR region of an RTL page is tracked: verified (#13695 is open).
  • Changeset: both chevrons now flip by the nearest dir instead of any RTL ancestor: verified.
  • Changeset: in an LTR menu inside an RTL page the chevron now points right, so icon, key and flyout side agree: verified for a menu inside its dir region, the case the changeset names as covered.
  • Changeset: a menu the layer portals out of an unsafe host is not covered: verified.
  • Changeset: an RTL menu is unchanged: verified for a menu inside its dir region; one portaled layout changes (suggestion above).
  • Changeset: a patch release of the core package: verified (a fix).

Files:

  • .changeset/dropdown-submenu-chevron-local-direction.md: clear (optional wording suggestion).
  • packages/core/src/DropdownMenu/menuDirectionMirror.stylex.ts: clear (optional header suggestion).
  • packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear.
  • packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 24, 2026 03:37
@cixzhang
cixzhang marked this pull request as draft November 24, 2026 03:38
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 7a644e2

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the chevron fix is right for a menu inside its dir region, but the release note's last sentence claims more than the change delivers.

Blocking

  • Miss: the changeset's last sentence, "An RTL menu is unchanged" (.changeset/dropdown-submenu-chevron-local-direction.md:5), is false for an RTL menu whose trigger sits in an unsafe host such as <p dir="rtl"> inside an LTR region of an RTL page, where the row chevron now points right while the flyout opens left (#13695); say "An RTL menu inside its dir region is unchanged" and name that layout.

Folding the edits you planned in #13691 into this branch resolves it. CI has not run on this draft head yet.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none.
  • Changeset: both chevrons flip by the nearest dir instead of any RTL ancestor — verified (menuDirectionMirror.stylex.ts:23, DropdownMenuSubMenu.tsx:1193, :1220).
  • Changeset: an LTR menu in an RTL page now shows the chevron pointing right, agreeing with the key and flyout as DR6 asks — verified (DropdownMenuSubMenu.test.tsx:251-269; DR6).
  • Changeset: this covers a menu inside its dir region, and a menu portaled out of an unsafe host is not covered — verified (Layer/layerHost.ts:162, Layer/useLayer.tsx:1217-1218).
  • Changeset: an RTL menu is unchanged — false for the portaled RTL-menu-in-LTR-region layout (#13695).
  • Description: the old chevrons used the any-ancestor mirror while the keys read the menu's computed direction — verified (utils/rtlStyles.ts:31; DropdownMenuSubMenu.tsx:1009-1013, :1103-1107).
  • Description: the four-row browser table — consistent with the code; not re-run on this head.
  • Description: the DropdownMenu folder already uses :dir(rtl) for row corners — verified (menuRowCorners.stylex.ts:25-37).
  • Description: the shared mirror is used by 28 files and stays unchanged — verified (28 files under packages/core/src reference it at the base, two of them the files this change moves off it; utils/rtlStyles.ts is untouched).
  • Description: no new public API — verified.
  • Description: the tests assert the computed transform, and the old mirror fails the nested-LTR flyout and Back tests — verified by the selectors (the base rule matches the RTL ancestor); not re-run on this head.
  • Description: Vitest, typecheck, ESLint, Prettier and pre-commit checks pass — not verified on this head (CI skipped the draft head, and no local run was possible).
  • Description: portaled <ul dir="ltr"><li> and <p dir="ltr"> menus are still flipped with the flyout on the right, unchanged — verified by code.
  • Description: the bottom-sheet chevrons still use the shared mirror — verified (DropdownMenu.tsx:893, ContextMenu.tsx:910, MenuBottomSheetActionList.tsx:198).
  • Description: follow-ups for the wording notes and the nested-region trade-off exist — verified (#13691, #13695).
  • File .changeset/dropdown-submenu-chevron-local-direction.md — blocking finding above.
  • File packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx — clear.
  • File packages/core/src/DropdownMenu/menuDirectionMirror.stylex.ts — non-blocking: the header runs 15 lines and its @output says "the menu's own direction" instead of the nearest dir (#13691).
  • File packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx — clear.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec aea1619

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The pull request is a draft that already carries the ci:run label, so marking it ready for review starts its run.

The release note now limits "unchanged" to an RTL menu inside its dir region and names the one portaled layout that changes, which resolves the earlier blocking finding; no blocking findings remain. Two optional wording notes, if you touch these files again:

  • The release note's portaled-layout sentence could also say that the drill-in Back chevron points forward there, as #13695 describes.
  • The menuDirectionMirror.stylex.ts header can drop to about 12 lines, with @output saying "the nearest dir" (#13691).
Claims and files checked

Review mode: full; reason: author-not-engowner

  • Changeset: both chevrons flip by the nearest dir instead of any RTL ancestor — verified (menuDirectionMirror.stylex.ts:23, DropdownMenuSubMenu.tsx:1193, :1220).
  • Changeset: an LTR menu in an RTL page used to show a left chevron while ArrowRight opened the flyout on the right, and now points right, as DR6 asks — verified (DropdownMenuSubMenu.tsx:1009-1013; DropdownMenuSubMenu.test.tsx:251-269).
  • Changeset: this covers a menu inside its dir region; a menu portaled out of an unsafe host keeps only its CSS direction and is not covered — verified (Layer/layerHost.ts:162, Layer/useLayer.tsx:1217-1218).
  • Changeset: an RTL menu inside its dir region is unchanged — verified (the old and new selectors both match when the nearest dir is RTL).
  • Changeset: in one portaled layout, an RTL menu inside an LTR region of an RTL page, the row chevron now points away from the flyout — verified by code; the drill-in Back chevron also reverses there (optional note above).
  • Description: fixes the reported chevron mismatch — verified against the issue's reproduction.
  • Description: the old chevrons used the any-ancestor mirror while the keys read the menu's computed direction and the flyout opens on that side — verified (utils/rtlStyles.ts:31; DropdownMenuSubMenu.tsx:1009-1013, :1103-1107, :1529).
  • Description: the four-row browser table — consistent with the code; not re-run on this head.
  • Description: the folder already uses :dir(rtl) for row corners — verified (menuRowCorners.stylex.ts:25-37).
  • Description: the shared mirror is used by 28 files and stays unchanged — verified (28 files at the base, two of them the files this change moves off it; utils/rtlStyles.ts untouched).
  • Description: no new public API — verified.
  • Description: the tests assert the computed transform, and the old mirror fails the nested-LTR flyout and Back tests — verified by the selectors; not re-run on this head.
  • Description: Vitest, typecheck, ESLint, Prettier and pre-commit checks pass — not verified on this head (CI skips drafts, and no local run was possible).
  • Description: portaled <ul dir="ltr"><li> and <p dir="ltr"> menus stay flipped with the flyout on the right, as before — verified by code.
  • Description: the bottom-sheet chevrons still use the shared mirror — verified (DropdownMenu.tsx:893, ContextMenu.tsx:910, MenuBottomSheetActionList.tsx:198).
  • Description: follow-ups for the wording notes and the nested-region trade-off exist — verified (#13691, #13695).
  • File .changeset/dropdown-submenu-chevron-local-direction.md — clear (optional note above).
  • File packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx — clear.
  • File packages/core/src/DropdownMenu/menuDirectionMirror.stylex.ts — non-blocking header note (#13691).
  • File packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx — clear.

Automated review (maintainer link)

'@astryxdesign/core': patch
---

[fix] DropdownMenu: a flyout row's chevron and a drill-in Back chevron now flip by the nearest `dir` instead of any `[dir="rtl"]` ancestor. In an LTR menu inside an RTL page, the chevron used to point left while ArrowRight opened the flyout on the right. It now points right, so the icon, the opening key and the flyout side agree, as the bidirectionality guide's DR6 asks. This covers a menu that renders inside its `dir` region. A menu whose trigger sits in an element the layer treats as unsafe is portaled out with only its CSS direction, and is not covered. An RTL menu inside its `dir` region is unchanged. In one portaled layout, an RTL menu inside an LTR region of an RTL page, the row chevron now points away from the flyout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional. In this layout the drill-in Back chevron loses its mirror too: the drilled-in view renders in the same portaled root layer, so :dir(rtl) reads the LTR host there as well (#13695 names both). A fuller ending:

In one portaled layout, an RTL menu inside an LTR region of an RTL page, the row chevron now points away from the flyout and the drill-in Back chevron points forward.

@cixzhang
cixzhang marked this pull request as ready for review November 24, 2026 06:31
@cixzhang
cixzhang marked this pull request as draft November 24, 2026 06:33
@cixzhang
cixzhang marked this pull request as ready for review November 24, 2026 06:34
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 24, 2026
@cixzhang
cixzhang merged commit 29aa0f4 into meta:main Nov 24, 2026
242 of 293 checks passed
@cixzhang

Copy link
Copy Markdown
Contributor

🤖 (Posted by Cindy's agent.) Merged, thank you @wbaha! Submenu chevrons now follow the menu's own nearest direction, so a left-to-right menu on a right-to-left page points its arrows toward where its submenus open. The one nested layout this doesn't cover yet is tracked in #13695, and the wording notes in #13691. It ships in the next release, with you credited. Thanks for a careful first contribution.

This branch was successfully deployed

1 active deployment
Preview — aea16197 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-rtl Run the RTL suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] DropdownMenu: a flyout chevron points left in a locally LTR menu inside an RTL document

2 participants