Repository navigation
fix(dropdown-menu): flip submenu chevrons by the nearest dir, not any RTL ancestor - #13685
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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 computedtransformisscaleX(-1)with the old component and empty with this change), so please assert the computedtransformin both RTL tests inDropdownMenuSubMenu.test.tsxinstead 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 fromdir, as the bidirectionality guide requires; CSSdirectionalone 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).
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.
|
/approve-spec e3a864a |
There was a problem hiding this comment.
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 CSSdirectioncopied, 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 inmenuDirectionMirror.stylex.tsto menus that render inside theirdirregion (the old selector also matched any RTL ancestor, not the nearest), or make the portaled layer carry thedirit 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 itsdirelement (Layer/useLayer.tsx:1218; Chromium<ul dir="ltr">mount).menuRowCorners.stylex.tsalready uses:dir(rtl)in this folder: verified (menuRowCorners.stylex.ts:23).rtlStyles.mirroris shared by 28 files and its header documents its behavior: verified (28 files underpackages/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.mirrorand 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).
…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.
|
/approve-spec 0f8c39d |
There was a problem hiding this comment.
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
dirregion 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
@outputsaying "the nearestdir" 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 nearestdirand, for a menu inside itsdirregion, 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/srcat 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
diris 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
dirinstead 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
dirregion, 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
dirregion; 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.
| /** | ||
| * @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. | ||
| */ |
There was a problem hiding this comment.
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.
*/|
/approve-spec a7d78aa |
There was a problem hiding this comment.
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
dirregion 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
@outputsaying "the nearestdir" 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 nearestdirand, for a menu inside itsdirregion, 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/srcat 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
mainin 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 testsmainadded. - 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
diris 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
dirinstead 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
dirregion, 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
dirregion; 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.
|
/approve-spec 7a644e2 |
There was a problem hiding this comment.
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 itsdirregion 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
dirinstead 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
dirregion, 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/srcreference it at the base, two of them the files this change moves off it;utils/rtlStyles.tsis 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@outputsays "the menu's own direction" instead of the nearestdir(#13691). - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx— clear.
…rors in Co-authored-by: wbaha <[email protected]>
|
/approve-spec aea1619 |
There was a problem hiding this comment.
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.tsheader can drop to about 12 lines, with@outputsaying "the nearestdir" (#13691).
Claims and files checked
Review mode: full; reason: author-not-engowner
- Changeset: both chevrons flip by the nearest
dirinstead 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
dirregion; 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
dirregion is unchanged — verified (the old and new selectors both match when the nearestdiris 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.tsuntouched). - 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.
| '@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. |
There was a problem hiding this comment.
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.
|
🤖 (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. |
Fixes #13655
User impact
Users of a
DropdownMenuwith a flyout sub-menu where the menu'sdirdiffers from the page's, and the menu renders inside itsdirregion: 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
rtlStyles.mirror. It flips for any[dir="rtl"]ancestor.direction, and the flyout opens on the side that direction gives.Expected behavior and authority
docs/design/bidirectionality.mdDR6: 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 nearestdir. For a menu inside itsdirregion, that is the same direction the key handler reads. The style lives in a newmenuDirectionMirror.stylex.tsnext to the other DropdownMenu StyleX helpers.menuRowCorners.stylex.tsalready uses:dir(rtl)in this folder.rtlStyles.mirroris 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:
main(04f0e4b).DropdownMenuSubMenu.test.tsxasserts the computedtransformof 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 oldrtlStyles.mirrorfails the nested-LTR flyout test and the nested-LTR Back icon test.Scope
Components: DropdownMenu
Testing
vitest run packages/core/src/DropdownMenu packages/core/src/ContextMenu: 24 files, 524 tests pass.tsc --noEmitinpackages/core, ESLint and Prettier on the changed files: clean.<ul dir="ltr"><li>in an RTL page. The layer portals the menu out and copies only the CSS direction, notdir(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 inlinedirection: ltrand nodir, the chevron is still flipped, and the flyout opens on the right (unchanged from before). Carryingdirthrough the layer would change every popover, so it needs its own change.DropdownMenu.tsx,MenuBottomSheetActionList.tsx,ContextMenu.tsx) still usertlStyles.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).