Repository navigation
fix(DropdownMenu): the Back row keeps a right-to-left parent title in its own direction - #13687
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 9faf7f9 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenuSubMenu | 82.2 kB (+525 B) · 11.1 kB CSS (+40 B) | — | ✓ · ✓ · ✓ |
| lab/MediaPlaybackRate | 230.5 kB (+231 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaSeekButton | 230.5 kB (+231 B) · 1.5 kB CSS (0) | — | — · — · — |
25 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/MediaTimeSlider | 230.5 kB (+231 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaVolume | 230.5 kB (+231 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaCaptionsButton | 230.5 kB (+230 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlayButton | 230.5 kB (+230 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/AudioPlayer | 240.3 kB (+229 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/MediaFullscreenButton | 230.5 kB (+229 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTime | 230.5 kB (+229 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/VideoPlayer | 237.9 kB (+229 B) · 2.1 kB CSS (0) | — | — · — · — |
| MoreMenu | 134.6 kB (+212 B) · 19.8 kB CSS (0) | — | — · — · — |
| DropdownMenu | 134.4 kB (+205 B) · 19.8 kB CSS (0) | — | ✓ · ✓ · ✓ |
| BreadcrumbItem | 104.2 kB (+200 B) · 14.0 kB CSS (0) | — | — · — · — |
| ContextMenu | 107.9 kB (+188 B) · 19.6 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 384.9 kB (+167 B) · 2.4 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 108.9 kB (+152 B) · 20.0 kB CSS (0) | — | — · — · — |
| TableCell | 109.1 kB (+148 B) · 20.2 kB CSS (0) | — | — · — · — |
| lab/Comments | 391.8 kB (+142 B) · 2.5 kB CSS (0) | — | — · — · — |
| Table | 127.3 kB (+118 B) · 21.2 kB CSS (0) | — | — · — · — |
| Markdown | 211.9 kB (+115 B) · 23.5 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 39.8 kB (0) · 7.3 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 30.2 kB (0) · 7.6 kB CSS (0) | — | ✓ · ✓ · ✓ |
| DropdownMenuDivider | 5.4 kB (0) · 548 B CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuGroup | 6.6 kB (0) · 3.4 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuItem | 29.4 kB (0) · 7.1 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuRadioGroup | 6.7 kB (0) · 3.4 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuRadioItem | 30.3 kB (0) · 7.6 kB CSS (0) | — | ✓ · ✓ · — |
Package size: @astryxdesign/core 8.01 MB packed (+1.0 kB); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the Back row fix works for a right-to-left title on a left-to-right page, but as written it reorders Latin and mixed titles on right-to-left pages and changes how long titles lay out.
- On a right-to-left page the isolated title at
DropdownMenuSubMenu.tsx:552is placed before the English text, so "Back to Actions" renders as "Actions Back to"; wrap the whole label in one span that carries the template's own direction (ltrfor the English template) and add a right-to-left test with a Latin title. - The Back row label is now a rich node, and
Itemcuts only a string label to one line (Item.tsx:836-846), so a long parent title wraps instead of ending in an ellipsis; keep the one-line ellipsis on that span and add a long-title test. PARENT_SLOTandbackToLabelsit betweenDropdownMenuSubMenu's JSDoc and its declaration, so the exported component loses its documentation in editors and the emitted types; move them above the JSDoc block.
The inline notes on those lines give the details. Please also update the description's "Unchanged: a Latin or mixed title" line once the right-to-left case is fixed.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- An all right-to-left parent title keeps its own order in the Back row on a left-to-right page: verified (
DropdownMenuSubMenu.tsx:544-556; markup reproduction in Chromium). - Before the change, the title's "!" and digits moved inside the Back row: verified (reproduction of the base markup).
- The title sits in an isolated span with
dir="rtl"when all its letters are right to left: verified (DropdownMenuSubMenu.tsx:552,textDirection.ts:43-52). - A Latin or mixed title is unchanged: false on a right-to-left page (first finding).
- A Back row with no parent title is unchanged: verified (
DropdownMenuSubMenu.tsx:647-653). - Every other row is unchanged: other rows verified; the titled Back row loses its one-line cut (second finding).
- A translation without the title slot falls back to the plain text: verified (
DropdownMenuSubMenu.tsx:545-547). - The new test fails on main and passes here: not verified; the tests could not be run in this review.
- DropdownMenu and ContextMenu unit tests pass, and Prettier and ESLint are clean: not verified, for the same reason.
- ContextMenu renders the same Back row: verified (
ContextMenu.tsx:815passes its label as the menu name). - The changeset is a patch fix note for the left-to-right case: verified.
Files:
.changeset/dropdown-menu-back-row-title-isolated.md: clear.packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: covers only a left-to-right page; needs right-to-left and long-title cases.packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: the three findings above.
| const isolated = Array.from(back.querySelectorAll('span')).find( | ||
| span => span.textContent === title, | ||
| ); | ||
| expect(isolated).toHaveAttribute('dir', 'rtl'); |
There was a problem hiding this comment.
This case covers an Arabic title on a left-to-right page. A case with direction right to left and a Latin title (expect "Back to" before the title), and one with a long title (expect a one-line cut), would cover the two regressions noted on the component.
|
/approve-spec dfc48c0 |
There was a problem hiding this comment.
Changes requested: an all right-to-left parent title now keeps its own order in the Back row on a left-to-right page, and the three earlier issues are fixed, but the new template-direction label breaks titles that mix scripts on right-to-left pages.
- On a right-to-left page the Back label is
dir="ltr"because its direction comes from the English template text alone (DropdownMenuSubMenu.tsx:534), so a title that mixes scripts, such as "ملف PDF", inheritsltrand shows its words in the opposite order from its trigger and frommain, against the internationalization rule that a cut label whose text mixes both scripts follows the page, the description's "mixed follows the page", and the changeset's claim that the title reads as on its trigger.
Taking the direction from the label's whole text, cutTextDirection(before + parent + after), keeps both fixes (an Arabic title on a left-to-right page, a Latin title on a right-to-left page) and lets a mixed title follow the page; please add a right-to-left case with a mixed title. This case comes from the template-direction wrapper suggested in the earlier round, which did not consider mixed titles. The backToLabel JSDoc could also be split into short sentences (inline suggestion, non-blocking).
Claims and files checked
Review mode: incremental; reason: none
- Claim: an all right-to-left title keeps its own direction and reads as on its trigger: verified (
DropdownMenuSubMenu.tsx:543,Button.tsx:1086). - Claim: the changeset says an Arabic or Hebrew title reads in the same order as on its trigger: false for a mixed-script title on a right-to-left page (the blocking finding).
- Claim: on
mainthe "!" moves to the far end of the Back row: verified (mainrenders one string label in the page direction). - Claim: a Latin title on a right-to-left page keeps "Back to" first, in the template's direction: verified (
:534-541,DropdownMenuSubMenu.test.tsx:1619-1644). - Claim: a mixed title on either page keeps "Back to" before it: verified for where "Back to" sits; the title's own word order is the blocking finding.
- Claim: the title's span takes
rtl,ltr, or for a mixed title the page's direction: false for a mixed title, which takes the label's direction (:543). - Claim: the label is one span in the template's direction with page alignment: verified (
:534-541). - Claim: a long title still ends in an ellipsis on one line: verified from the styles (
:549-558inside the row's flex column); not measured in a browser. - Claim: a translation without the title slot falls back to plain text: verified (
:530-532). - Claim: an untitled Back row and every other row are unchanged: verified (
:675; no other row changes). - Claim: two new drill-in cases, the first failing on
main: verified by reading; the tests could not be run here. - Claim: Chromium comparison, red-first run, unit runs, Prettier and ESLint: not reproduced, as the tools could not run here.
- Claim: no knowledge record changes, and the bidirectionality and internationalization records govern: verified; the internationalization rule is the one the blocking finding contradicts.
- Claim: the overlap with #13685 touches different lines: verified (the two heads merge without conflict).
- Claim: ContextMenu renders the same Back row: verified (
ContextMenu.tsx:815). - File
.changeset/dropdown-menu-back-row-title-isolated.md: its trigger-order claim is false for mixed titles on right-to-left pages. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: blocking finding at:534and:543; non-blocking comment-style note at:523-528. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear, apart from the missing right-to-left mixed-title case.
…o a mixed title follows the page
|
/approve-spec 99f5479 |
There was a problem hiding this comment.
Changes requested: the Back row now keeps a right-to-left parent title in its own direction and reads like its trigger on either page, but the new right-to-left mixed-title test does not check the label span it describes.
- The case "lets a Back label with a mixed parent title follow a right-to-left page" (
DropdownMenuSubMenu.test.tsx:1666-1670) takes the first span whose text is the whole label, which is Item's content span rather than thebackToLabelspan, so it still passes with the label forced todir="ltr"as in the previous revision; asserting on the title's parent, for exampleexpect(isolated?.parentElement).not.toHaveAttribute('dir'), makes it fail on that rule and pass here.
The component change itself matches the bidirectionality and internationalization rules for every page and title direction checked.
Claims and files checked
Review mode: same-head; reason: none
- Claim: an all right-to-left parent title keeps its own direction in the Back row and reads as on its trigger: verified (
DropdownMenuSubMenu.tsx:543,Button.tsx:1086). - Claim: on
mainthe title joins the English text, so its "!" and number move: verified (mainrenders one string label in the page's direction). - Claim: it affects menus whose title is in the other script than the page, on a phone or with
presentation="drill-in": verified (DropdownMenuSubMenu.tsx:648-654,:1210). - Claim: a Latin title on a right-to-left page and a mixed title on either page keep "Back to" before the title, as on
mainwheremainwas right: verified for reading order (:533-541); a mixed label takes the page's direction, as the description's Change section says. - Claim: a long title still ends in an ellipsis on one line: verified from the styles (
:549-558); not measured in a browser. - Claim: an untitled Back row and every other row are unchanged: verified (
:675). - Claim: the label is one span in the direction of its whole text,
ltrwith no right-to-left letter and none when scripts mix, with page alignment: verified (:533-541). - Claim: the title's span takes
rtl,ltror the page's direction by the same rule: verified (:543,textDirection.ts:43-52). - Claim: a translation without the title slot falls back to plain text: verified (
:530-532). - Claim: three new drill-in cases, the first failing on
main: the first two verified by reading; the third does not check the label span (the blocking finding). - Claim: the changeset's patch fix, an Arabic or Hebrew title reads in the same order as on its trigger: verified for every page and title direction checked.
- Claim: the bidirectionality and internationalization rules govern and no record changes: verified.
- Claim: Chromium comparison, red-first run, unit runs, Prettier and ESLint: not independently reproduced.
- Claim: ContextMenu renders the same Back row: verified (
ContextMenu.tsx:815). - Claim: the overlap with #13685 touches different lines: verified (the two heads merge without conflict).
- Claim: fixes #13656: verified (a custom trigger's name reaches the same Back row through
DropdownMenu.tsx:1171-1176). - File
.changeset/dropdown-menu-back-row-title-isolated.md: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: blocking finding at:1666-1670.
|
/approve-spec 9bf351a |
There was a problem hiding this comment.
Approved: CI passes on this head.
The drilled-in Back row now keeps a right-to-left parent title in its own direction, a Latin title keeps its start and end punctuation on a right-to-left page, and a mixed title follows the page as before; the three new drill-in cases cover each of these and pass in CI. Two optional follow-ups:
- Miss: the description's "Also covered" bullet says a mixed title keeps the template's own direction, but a mixed label follows the page (
DropdownMenuSubMenu.tsx:534), as the Change section says. - The long-title one-line cut still has no automated check, and only a browser case could prove it.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Claim: an all right-to-left parent title keeps its own direction in the Back row, so its punctuation order matches the trigger: verified (
DropdownMenuSubMenu.tsx:543,Button.tsx:1086; case atDropdownMenuSubMenu.test.tsx:1595-1617). - Claim: it affects menus whose title is in the other script than the page, on a phone or with
presentation="drill-in": verified (DropdownMenuSubMenu.tsx:648-654,:1210-1223). - Claim: before the fix the title joined the English text and the bidi algorithm moved its "!" to the far end: verified from the bidi rules (the base renders one string label with no direction of its own); not observed in a browser.
- Claim: the title now sits in an isolated span with
dir="rtl"when all its letters are right to left: verified (:543,textDirection.ts:43-52). - Claim: a Latin title on a right-to-left page and a mixed title on either page keep "Back to" before the title, as before where it was right: verified for reading order (
:534-541); the bullet's "in the template's own direction" is imprecise for a mixed title, whose label follows the page, as the Change section says. - Claim: a long title still ends in an ellipsis on one line: verified from the styles (
:549-558); not measured in a browser. - Claim: an untitled Back row and every other row are unchanged: verified (
:675). - Claim: the label is one span in the direction of its whole text,
ltrwith no right-to-left letter and none when scripts mix, with page alignment, cut to one line: verified (:534-541,:549-558). - Claim: the title's span takes
rtl,ltror the page's direction by the same rule: verified (:543). - Claim: a translation without the title slot falls back to the plain text: verified (
:530-532). - Claim: three new drill-in cases (an Arabic title on a left-to-right page that fails before the fix, a Latin title on a right-to-left page, a mixed title on a right-to-left page with no direction on the label or the title): verified by reading (
DropdownMenuSubMenu.test.tsx:1595-1673) and passing in CI's unit run on this head. - Claim: the changeset's patch fix, an Arabic or Hebrew title reads in the same order as on its trigger: verified for every page and title direction checked.
- Claim: the bidirectionality and internationalization rules govern and no record changes: verified.
- Claim: ContextMenu renders the same Back row: verified (
ContextMenu.tsx:815). - Claim: the unit tests pass and Prettier and ESLint are clean: verified in CI on this head; the Chromium comparison and the red-first run were not reproduced here.
- Claim: the overlap with #13685 touches different lines: verified (the two heads merge without conflict).
- Claim: fixes #13656: verified (the issue's Arabic trigger title in an English menu reaches this Back row).
- File
.changeset/dropdown-menu-back-row-title-isolated.md: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear.
…k-row-title-isolated # Conflicts: # packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx
|
/approve-spec 37569f2 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet; it was skipped while the pull request was a draft and is queued now that it is ready for review.
The merge of main keeps the Back-row fix and its three drill-in tests unchanged, and the row still reads like its trigger for right-to-left, Latin and mixed titles on either page.
Non-blocking:
- The description's "Also covered" bullet says a mixed title keeps the template's own direction; it follows the page's direction (
DropdownMenuSubMenu.tsx:534), as the Change section says. - The long-title one-line cut still has no automated check.
Claims and files checked
Review mode: incremental; reason: none
- Claim: the Back row keeps an all right-to-left parent title in its own direction, as on its trigger. Verified:
DropdownMenuSubMenu.tsx:543, test atDropdownMenuSubMenu.test.tsx:1612-1634. - Claim: before the fix, an Arabic title such as "مرحبا 42!" had its "!" and number moved in the Back row. Verified by the bidi rules on the base markup and by the linked issue.
- Claim: a Latin title on a right-to-left page keeps "Back to" first, on one left-to-right label span. Verified:
DropdownMenuSubMenu.tsx:534-541, test atDropdownMenuSubMenu.test.tsx:1636-1661. - Claim: a mixed title keeps "Back to" first "in the template's own direction". Reading order verified; the direction wording is inaccurate on a right-to-left page (non-blocking, above).
- Claim: a mixed title's label and title take no direction and follow the page. Verified:
DropdownMenuSubMenu.tsx:534,:543, test atDropdownMenuSubMenu.test.tsx:1663-1690. - Claim: a long title still ends in an ellipsis on one line. Verified in code (
DropdownMenuSubMenu.tsx:549-558); no automated check. - Claim: a translation without the title slot falls back to plain text, and an untitled Back row is unchanged. Verified:
DropdownMenuSubMenu.tsx:530-532,:675. - Claim: the new right-to-left-title case fails on main. Verified by reading: on main no span holds the title alone.
- Claim: the DropdownMenu and ContextMenu unit tests and the lint pass. Passed in CI on the previous revision; not yet finished on this revision.
- Claim: the browser comparison of main and this change. The author's statement; not re-run in this review.
- Claim: no public API or record changes, and the overlap with #13685 touches different lines. Verified: no export or record changes, and the two branches merge cleanly.
- Changeset: a patch fix that keeps a right-to-left title in its own order in the Back row. Verified on a left-to-right page, where main moved its punctuation.
- File:
.changeset/dropdown-menu-back-row-title-isolated.md: clear. - File:
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear; the merge keeps main's mount-open case before the three new cases. - File:
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear.
There was a problem hiding this comment.
Changes requested: the Back-row fix and its three drill-in tests are correct, but the pull request description misstates one case.
- Miss: The description's "Also covered" bullet says a mixed-script title keeps "Back to" before the title "in the template's own direction" on either page, but on a right-to-left page the label and the title take no
dirand follow the page (DropdownMenuSubMenu.tsx:534,:543, and the test atDropdownMenuSubMenu.test.tsx:1663-1690), so reword it to say a mixed title follows the page's direction, as on main.
Editing the description is enough; no code change is needed. Non-blocking: the long-title one-line cut still has no automated check.
Claims and files checked
Review mode: same-head; reason: none
- Claim: the Back row keeps an all right-to-left parent title in its own direction, so its punctuation matches the trigger. Verified:
DropdownMenuSubMenu.tsx:543with the trigger's rule inButton.tsx:1086; test atDropdownMenuSubMenu.test.tsx:1612-1634. - Claim: it affects menus whose title is in the other script, on a phone or with a drill-in sub-menu. Verified:
DropdownMenuSubMenu.tsx:644-654. - Claim: before the fix, an Arabic title such as "مرحبا 42!" had its "!" moved to the far end in the Back row. Verified by the bidi rules on the base markup and the linked issue.
- Claim: a Latin title on a right-to-left page keeps "Back to" first, in the template's direction. Verified:
DropdownMenuSubMenu.tsx:534-541; test atDropdownMenuSubMenu.test.tsx:1636-1661. - Claim: a mixed title on either page keeps "Back to" first "in the template's own direction". False on a right-to-left page, where it follows the page (blocking, above).
- Claim: a long title still ends in an ellipsis on one line. Verified in code (
DropdownMenuSubMenu.tsx:549-558); no automated check. - Claim: an untitled Back row and every other row are unchanged, and a translation without the title slot falls back to plain text. Verified:
DropdownMenuSubMenu.tsx:530-532,:675. - Claim: the label takes its whole text's direction and the title its own, with mixed text following the page. Verified:
DropdownMenuSubMenu.tsx:534,:543; test atDropdownMenuSubMenu.test.tsx:1663-1690. - Claim: the new right-to-left-title case fails on main. Verified by reading: on main no span holds the title alone.
- Claim: the DropdownMenu and ContextMenu unit tests and the lint pass. CI is running on this head; the tests passed in CI on the previous revision.
- Claim: a browser comparison of main and this change. The author's statement; not re-run here.
- Claim: ContextMenu renders the same row. Verified:
ContextMenu.tsx:815. - Claim: no public API or record changes, and the overlap with #13685 touches different lines. Verified: no export or record changes, and the two branches merge cleanly.
- Changeset: a patch fix that keeps a right-to-left title in its own order in the Back row. Verified.
- File:
.changeset/dropdown-menu-back-row-title-isolated.md: clear. - File:
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear. - File:
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear.
There was a problem hiding this comment.
Approved: the Back-row fix keeps a right-to-left parent title in its own direction, its three drill-in tests cover the left-to-right, right-to-left Latin and mixed-title cases, and CI passes on this head.
- Non-blocking: the long-title one-line cut has no automated check; a browser case with a long parent title (expect one line ending in "…") would guard it.
Claims and files checked
Review mode: same-head; reason: none
- Changed rules (0): none.
- Claim: the Back row keeps an all right-to-left parent title in its own direction, so it reads in the same order as its trigger. Verified:
DropdownMenuSubMenu.tsx:543gives the title's isolate the trigger's rule (Button.tsx:1086); test atDropdownMenuSubMenu.test.tsx:1612-1634. - Claim (changeset): an Arabic or Hebrew title no longer has its punctuation and numbers moved; a patch release. Verified: the right-to-left check covers Arabic and Hebrew script (
firstStrongDirection.ts:38-41); the changeset is a patch. - Claim: it affects drill-in on a phone or with
presentation="drill-in". Verified:DropdownMenuSubMenu.tsx:647-654and:1210. - Claim: before, the title was inserted straight into the English text and reordered. Verified: the base renders the formatted string in one label span with no direction (
Item.tsx:863-874). - Claim: a Latin title on a right-to-left page keeps "Back to" before it, on one left-to-right label span. Verified:
DropdownMenuSubMenu.tsx:534-541; test at:1636-1661. - Claim: a mixed-script title follows the page on either page, as before, with no direction on the label or the title. Verified:
:534and:543; test at:1663-1690for a right-to-left page. - Claim: a long title still ends in an ellipsis on one line. Verified by code (
:549-558); not automated, as the description says. - Claim: an untitled Back row and every other row are unchanged, and a translation without the title slot falls back to plain text. Verified:
:675and:530-532. - Claim: the first new case fails before this change. Verified by reading the base: no span holds the title alone there, so the assertion fails.
- Claim: unit tests, Prettier and eslint pass. Verified: the unit, lint and typecheck checks are green on this head.
- Claim: a Chromium comparison shows the base reordering the title and this change matching the trigger. Consistent with the code and the bidi rules; not reproduced in a browser here.
- Claim: ContextMenu gets the same fix. Verified: it re-exports this sub-menu (
ContextMenu/index.ts:47-49) and passes its label as the menu title (ContextMenu.tsx:815). - Claim: no overlap with the sub-menu chevron fix in #13685. Verified: the two heads merge cleanly.
- Claim: the bidirectionality content-direction rule and the internationalization text-direction rule govern the change, with no record change. Verified: both are current and unchanged.
- File
.changeset/dropdown-menu-back-row-title-isolated.md: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear; the long-title case is the non-blocking point above.
…k-row-title-isolated
|
/approve-spec 76446ad |
There was a problem hiding this comment.
Approved pending CI: lint, typecheck, the builds and every unit-test shard pass on this head, and only the test check is still running. The Back row reads like its trigger for right-to-left, Latin and mixed parent titles on either page, and the three drill-in tests cover each direction rule.
- Non-blocking: the long-title one-line cut has no automated check; a browser case with a long parent title (expect one line ending in "…") would guard it.
Claims and files checked
Review mode: same-head; reason: none
- Claim (changeset): the Back row keeps a right-to-left parent title in its own direction, so an Arabic or Hebrew title reads as on its trigger; a patch release. Verified:
DropdownMenuSubMenu.tsx:557gives the title's isolate the trigger's rule (Button.tsx:1086), Arabic and Hebrew both count as right-to-left (firstStrongDirection.ts:39), and the changeset is a patch. - Claim: it affects drill-in on a phone or with
presentation="drill-in". Verified:DropdownMenuSubMenu.tsx:662-668. - Claim: before, the title was inserted straight into the English text, so the "!" moved to the far end and the number swapped sides. Verified: the base renders the formatted string in one label span with no direction (
Item.tsx:863-874), where the bidi rules place the final "!" after the right-to-left run. - Claim: an all right-to-left title sits in an isolated span with
dir="rtl"and reads as the trigger does. Verified:DropdownMenuSubMenu.tsx:557; test atDropdownMenuSubMenu.test.tsx:1632-1654. - Claim: a Latin title on a right-to-left page keeps "Back to" before it, on one left-to-right label span. Verified:
DropdownMenuSubMenu.tsx:548-555; test atDropdownMenuSubMenu.test.tsx:1656-1681. - Claim: a mixed-script title follows the page on either page, as before, with no direction on the label or the title. Verified:
DropdownMenuSubMenu.tsx:548,:557andtextDirection.ts:43-52,:125-139; test atDropdownMenuSubMenu.test.tsx:1683-1710for a right-to-left page. - Claim: a long title still ends in an ellipsis on one line. Verified by code (
DropdownMenuSubMenu.tsx:563-572); not automated, as the description says. - Claim: an untitled Back row and every other row are unchanged, and a translation without the title slot falls back to plain text. Verified:
DropdownMenuSubMenu.tsx:683-689,:544-546. - Claim: the first new case fails before this change. Verified by reading the base: no span holds the title alone there, so the assertion fails.
- Claim: the unit tests pass and the code is lint-clean. Verified on this head: the lint job and all four UI unit-test shards pass, including the 92 sub-menu tests.
- Claim: a Chromium comparison shows the base reordering the title and this change matching the trigger. Consistent with the code and the bidi rules; not reproduced in a browser here.
- Claim: ContextMenu gets the same fix. Verified: it re-exports this sub-menu (
ContextMenu/index.ts:47-49) and passes its label as the menu title (ContextMenu.tsx:817). - Claim: it fixes the linked issue's reproduction, a custom trigger with an Arabic title. Verified: a custom trigger's accessible name becomes the menu title (
DropdownMenu.tsx:579-586), so it gets the same isolate. - Claim: no overlap with the sub-menu chevron fix in #13685. Verified: the two heads merge cleanly.
- Claim: the bidirectionality content-direction rule and the internationalization text-direction rule govern the change, with no record change. Verified: both are current and unchanged.
- File
.changeset/dropdown-menu-back-row-title-isolated.md: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear; the long-title case is the non-blocking point above.
Primary intent
Bug fix: DropdownMenu's drilled-in "Back to …" row keeps a right-to-left parent title in its own direction, so its punctuation order matches the trigger.
User impact
presentation="drill-in".dir="rtl"when all its letters are right to left, so the Back row reads exactly as the trigger does.ltr). A mixed-script title, on either page, follows the page's direction, as on main (the label and the title take nodir). A long title still ends in an ellipsis on one line.Change
DropdownMenuSubMenu.tsx: the Back row label is one span in the direction of its whole text (cutTextDirectionof "Back to <title>":ltrwhen it has no right-to-left letter, nodirwhen it mixes scripts, so it follows the page; withpageAlign), cut to one line with an ellipsis as a string label is. Inside it, the parent title sits in anisolatedTextspan with its own direction from the same rule: all right-to-left letters givertl, no right-to-left letter givesltr, mixed follows the page. A translation without the title slot falls back to the plain text.dir="rtl"span; fails on main) a Latin title on an RTL page (onedir="ltr"label span reading "Back to <title>"), and a mixed title on an RTL page (nodiron the label or the title, so both follow the page).[fix]patch.Authority
design:bidirectionalityDR2 (content keeps its own direction, isolated from the text around it);architecture:internationalizationINV11 (cutTextDirection, the one owner of a label's direction). Records-decided; no record change.Evidence
Not automated: the long-title one-line cut. jsdom has no layout, so a unit test cannot see the ellipsis; the label span uses the same
overflow: hidden,white-space: nowrap,text-overflow: ellipsisstyles as a string row label. Accepted for this fix.Chromium (main vs head, LTR page, Arabic trigger title): main reorders the title in the Back row; head matches the trigger.
Red first: the new case fails on main and passes here.
Units: DropdownMenu and ContextMenu folders pass.
Prettier and eslint are clean.
Writing rubric results
Scope
Components: DropdownMenu (and ContextMenu, which renders the same sub-menu row).
Fixes #13656. Thanks to @korkt-kim for the bidi reproduction.
Overlap
Overlap checked: #13685 (it fixes the direction of the sub-menu chevrons, issue #13655; this PR changes only how the Back row's text inserts the parent title, so the two touch different lines of
DropdownMenuSubMenu.tsxand its test file)Owner and land path