Repository navigation
feat(core): DropdownMenu and sub-menu flyouts get a theme target on their floating box - #12426
josephfarina wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| BreadcrumbItem | 98.2 kB (+28 B) · 13.3 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 79.1 kB (+28 B) · 10.5 kB CSS (0) | — | — · — · — |
| TableCell | 104.7 kB (+28 B) · 19.3 kB CSS (0) | — | — · — · — |
15 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableHeaderCell | 104.5 kB (+28 B) · 19.1 kB CSS (0) | — | — · — · — |
| lab/Comments | 379.4 kB (+28 B) · 2.5 kB CSS (0) | — | — · — · — |
| Table | 121.7 kB (+27 B) · 19.8 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 372.3 kB (+27 B) · 2.4 kB CSS (0) | — | — · — · — |
| DropdownMenu | 108.9 kB (+23 B) · 18.9 kB CSS (0) | — | — · — · — |
| MoreMenu | 109.2 kB (+23 B) · 18.9 kB CSS (0) | — | — · — · — |
| ContextMenu · Storybook | 103.5 kB (+16 B) · 18.8 kB CSS (0) | 729 (0) | — · — · — |
| Markdown | 205.3 kB (+14 B) · 22.1 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 35.9 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 28.8 kB (0) · 7.3 kB CSS (0) | — | — · — · — |
| DropdownMenuDivider | 5.3 kB (0) · 548 B CSS (0) | — | — · — · — |
| DropdownMenuGroup | 6.4 kB (0) · 3.4 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 28.0 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioGroup | 6.6 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 28.8 kB (0) · 7.3 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.68 MB packed (+304 B); no new dependencies.
API changes: core +1 · ~0 · −0
1 API change (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | core |
Theme targets · target dropdown-menu-popup (DropdownMenu) |
target dropdown-menu-popup (DropdownMenu) |
defineTheme({components: {'dropdown-menu-popup': {…}}}) |
Wide change (shared styles: packages/themes/probe/src/probeTheme.ts): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and three fixes are needed either way.
The new FR24 and the seventh target in FR2 change the DropdownMenu record, so an engineering owner records the decision by commenting /approve-spec <full head SHA> (the author may, as an engineering owner), and that decision should also settle whether ContextMenu's sub-menu flyouts carry dropdown-menu-popup while ContextMenu's own box keeps context-menu.
Blocking:
- The probe theme is not regenerated for the new target, so the Lint check fails with "Probe theme out of date": run
pnpm visual:probe-themeand commit the updatedpackages/themes/probe/src/probeTheme.ts. - The title and description say every menu box gets the target, but ContextMenu's own box keeps only
context-menuwhile its sub-menu flyouts now takedropdown-menu-popup, so a theme using it gives context menus a restyled flyout beside an unchanged root: narrow the wording to DropdownMenu and its sub-menu flyouts, and state the ContextMenu case in FR24 and the changeset, with a test. - FR24's Basis and the description cite theming-surface INV6, which keeps state on its owning target, for the painted-element rule: cite INV4 (targets paint) and INV5 (a part on a shared primitive's surface) instead.
Smaller suggestions are in the inline comments.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: today the menu target sits on the list inside the root box, so box styles on it draw a second box. Verified (base
DropdownMenu.tsx, menu list). - Claim: box styles on the popover target restyle every popover. Verified (every
usePopoversurface carries it). - Claim: sub-menu flyouts paint their own box. Verified (
DropdownMenuSubMenu.tsxflyout styles). - Claim: the root box gets the new target through the existing surface-target option, as Selector and MultiSelector do. Verified (
DropdownMenu.tsx:1171). - Claim: each flyout gets it beside the menu target, on the dialog frame when it has a header or footer. Verified (
DropdownMenuSubMenu.tsx:1221,:1449, new tests). - Claim: one theme entry styles every menu box. False for ContextMenu's own box (blocking finding 2).
- Claim: the default look is unchanged; only classes are added. Verified (no CSS change; built theme surfaces identical).
- Claim: FR2 lists seven targets, FR24 places the new one, and the anatomy gains a pointer popup part. Verified in the record and docs.
- Claim: Popover's optional component surface target backs the root placement. Verified (Popover DEC-2).
- Claim: theming-surface INV6 puts the target on its painted element. False (blocking finding 3).
- Claim: callers make no new decision. Verified.
- Claim: when the popover target and the new target set the same property, the later theme entry wins. Verified (one-class rules in theme order).
- Claim: the new tests cover the root box, a plain flyout and a flyout with header and footer. Verified; they pass.
- Claim: the theming-targets test passes. Verified.
- Claim: the DropdownMenu, ContextMenu, Popover and theme suites pass. Verified (2,448 tests in 56 files pass at this head).
- Claim: the knowledge check and changeset check pass. Verified (knowledge check passes; a patch feature changeset is what the script requires).
- Changeset: every pointer menu's box (root popover and each sub-menu flyout) carries the new target, and the menu target stays on the list. Verified for DropdownMenu; it does not mention ContextMenu's flyouts (blocking finding 2).
- File
.changeset/dropdown-menu-popup-target.md: blocking finding 2. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: blocking findings 2 and 3; spec decision pending. - File
packages/core/src/DropdownMenu/DropdownMenu.doc.mjs: blocking finding 1. - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: non-blocking (the theme-rule case also passes without the change). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: clear (comment suggestion only). - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: blocking finding 2 (ContextMenu flyouts); comment suggestions.
|
Owner decision (engineering owner, covering this pull request): DropdownMenu's floating box and its sub-menu flyouts get the |
|
/approve-spec e62161e |
There was a problem hiding this comment.
Changes requested: one citation fix, then an engineering owner approves the new head. The spec decision itself is approved for this head, and the probe theme and the ContextMenu wording from the last review are fixed.
Blocking:
- FR24's Basis and the description cite theming-surface INV6 (state stays on the owning target) for the painted-element rule, which is INV4 (targets paint) and INV5 (a part on a shared primitive's surface), so cite INV4 and INV5 instead.
The smaller suggestions on the theme-rules test case and the flyout comment still stand in their inline threads.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: today the menu target sits on the list inside the root box, so box styles on it draw a second box. Verified (base
DropdownMenu.tsx:1867; browser probe on the base). - Claim: box styles on the popover target restyle every popover. Verified (
usePopover.tsx:692puts it on every popover surface). - Claim: sub-menu flyouts paint their own box, so a root and its flyouts disagree. Verified (flyout styles in
DropdownMenuSubMenu.tsx; base probe). - Claim: the root box gets the new target through the existing surface-target option, beside the popover target, as the selector popups do. Verified (
DropdownMenu.tsx:1171,Selector.tsx:1444). - Claim: each flyout carries it beside the menu target, on the dialog frame when it has a header or footer. Verified (
DropdownMenuSubMenu.tsx:1221,:1449; tests fail on the base and pass here). - Claim: under a ContextMenu the flyouts carry it while the context menu's own box keeps its own target. Verified (
ContextMenu.test.tsx:965; probe). - Claim: one theme entry styles a DropdownMenu's box and every sub-menu flyout. Verified (probe: the border reaches the root box and the flyouts).
- Claim: no style changes, and the default look is byte-identical. Verified (the built core stylesheet has the same hash and 296,793 bytes on both sides; the no-theme frame is identical).
- Claim: FR2 lists seven targets, FR24 places the new one, and the anatomy gains a pointer popup part. Verified (record and component docs).
- Claim: Popover's optional component surface target backs the root placement. Verified (Popover DEC-2).
- Claim: theming-surface INV6 puts the target on its painted element. False (the blocking finding).
- Claim: the new target and class are documented, and the DOM gains only that class. Verified (
DropdownMenu.doc.mjs:150; probe). - Claim: callers make no new decision. Verified (no prop or default changes).
- Claim: when the popover target and the new target set the same property, the later theme entry wins. Verified (the compiler writes single-class rules in theme order in one scope).
- Claim: the later part-ordering change marks the new target as sitting on the popover. Not part of this pull request (nothing at this head declares it).
- Claim: the new tests cover the root box, a plain flyout, a flyout with header and footer, and the ContextMenu case. Verified (they fail on the base and pass here).
- Claim: the theming-targets test, the DropdownMenu, ContextMenu, Popover and theme suites, the probe-theme check, the knowledge check and the changeset check pass. Verified (2,449 tests at this head, one more than stated, from the new ContextMenu case).
- Claim: the record text describes present behavior and adds no status lines. Verified.
- Changeset: a DropdownMenu's box and each sub-menu flyout carry the new target, the menu target stays on the list, and under a ContextMenu only the flyouts carry it. Verified.
- File
.changeset/dropdown-menu-popup-target.md: clear. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: blocking finding; non-blocking test-case note. - File
packages/core/src/ContextMenu/ContextMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.doc.mjs: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: non-blocking (the theme-rules case also passes on the base). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: non-blocking (comment wording). - File
packages/themes/probe/src/probeTheme.ts: clear (matches its generator).
|
/approve-spec f6c4a8c |
There was a problem hiding this comment.
Approved pending CI: the CI run on this head was cancelled because the CI queue was full, so it needs a re-run before merge. The spec change is approved for this head, and every fix from the last review is in.
- Non-blocking: a radius set on
dropdown-menu-popupdoes not reach the row highlights, which still take their corners from thedropdown-menuradius, so a square box keeps 8px row highlights unless the theme also setsdropdown-menu; a line in the target's docs or the changeset would help theme authors.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: today the menu target sits on the list inside the box, so box styles there paint a second box. Verified (
DropdownMenu.tsx:1870; browser probe on the base). - Claim: box styles on the popover target restyle every popover. Verified (
usePopover.tsx:692). - Claim: sub-menu flyouts paint their own box, so a root menu and its flyouts can disagree. Verified (
DropdownMenuSubMenu.tsx:216,:323). - Claim: the root box gets the new target through the existing surface-target option, beside the popover target, as the selector popups do. Verified (
DropdownMenu.tsx:1171,Selector.tsx:1444,MultiSelector.tsx:1509). - Claim: each flyout carries it beside the menu target, on the dialog frame when it has a header or footer. Verified (
DropdownMenuSubMenu.tsx:1221,:1449; the tests fail on the base and pass here). - Claim: under a ContextMenu the flyouts carry it while the context menu's own box keeps its own target. Verified (
ContextMenu.test.tsx:965; browser probe). - Claim: one theme entry styles a menu's box and every flyout. Verified (browser probe: border, corners and shadow reach the root box and the flyouts).
- Claim: no style changes, and the default look is byte-identical. Verified (the built core stylesheet is identical at 296,793 bytes; unthemed frames are identical).
- Claim: the record lists seven targets, places the new one with its exclusions, and adds a pointer popup part. Verified (record and component docs; the exclusions read from source).
- Claim: the popover record's optional surface target and the theming-surface painted-element rules back the placement. Verified.
- Claim: the new target and class are documented, the DOM gains only that class, and callers make no new decision. Verified (
DropdownMenu.doc.mjs:150; the diff adds no prop, style or default). - Claim: moving the menu target onto the box and adding a popover prop were rejected. Consistent (neither appears).
- Claim: when the popover target and the new target set one property, the later theme entry wins, as for the selector popup. Verified (the compiler writes equal single-class rules in theme order).
- Claim: a later part-ordering change marks the new target as sitting on the popover target. Not part of this pull request (nothing at this head declares it).
- Claim: the new tests cover the root box, a plain flyout, a flyout with header and footer, the ContextMenu case and the documented target. Verified (all five fail on the base and pass here).
- Claim: the theming-targets test and the DropdownMenu, ContextMenu, Popover and theme suites pass. Verified (2,449 tests at this head, one more than the stated count).
- Claim: the probe-theme, knowledge and changeset checks, eslint and prettier pass. Verified.
- Claim: the record text describes present behaviour and adds no open questions or status lines. Verified.
- Claim: one capability, no unrelated changes, docs and tests included, and no internal context in public text. Verified.
- Changeset: a menu's box and each flyout carry the new target, the menu target stays on the list, and under a ContextMenu only the flyouts carry it. Verified.
- File
.changeset/dropdown-menu-popup-target.md: clear. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear. - File
packages/core/src/ContextMenu/ContextMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.doc.mjs: non-blocking note (row radius). - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear. - File
packages/themes/probe/src/probeTheme.ts: clear (matches its generator).
| className: 'astryx-dropdown-menu', | ||
| visualProps: ['presentation'], | ||
| }, | ||
| {className: 'astryx-dropdown-menu-popup'}, |
There was a problem hiding this comment.
Non-blocking: a radius set on this target reaches the box but not the rows. Row highlights take their corners from --_dropdown-menu-radius minus the menu padding (DropdownMenuItem.tsx:64), and only dropdown-menu and context-menu feed that variable (derivedVarRegistry.ts). With borderRadius: '0px' here, the box is square and the row highlights stay at 8px. A line in this target's description or the changeset ("set dropdown-menu's radius too for matching rows") would save theme authors the surprise.
f6c4a8c to
3736642
Compare
|
/approve-spec 3736642 |
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head. An engineering owner approved the spec change for this exact head after the rebase, and the regenerated probe theme matches its generator.
- Non-blocking: a radius set on
dropdown-menu-popupsquares the box but not the row highlights, which take their corners from thedropdown-menuradius; a line in the target's docs or the changeset would help theme authors. - Non-blocking: the description says box styles on
popoverrestyle tooltips' cards, but Tooltip and HoverCard carry their own targets; pickers, selectors and anchored dialogs are the surfaces that sharepopover.
Claims and files checked
Review mode: full; reason: rebase
- Claim: today the menu target sits on the list inside the box, so box styles there paint a second box. Verified (
DropdownMenu.tsx:1870,:185). - Claim: box styles on the popover target restyle every popover. Verified for every
usePopoversurface (usePopover.tsx:692); false for the tooltip example, since Tooltip and HoverCard carrytooltipandhover-card(non-blocking note above). - Claim: sub-menu flyouts paint their own box. Verified (
DropdownMenuSubMenu.tsx:213-218,:330-331). - Claim: the root box takes the new target through the existing surface-target option, beside the popover target, as the selector popups do. Verified (
DropdownMenu.tsx:1171,Selector.tsx:1455,MultiSelector.tsx:1516). - Claim: each flyout carries it beside the menu target, on the dialog frame when it has a header or footer. Verified (
DropdownMenuSubMenu.tsx:1221,:1449; the tests fail on the base and pass here). - Claim: under a ContextMenu the flyouts carry it while the context menu's box keeps its own target. Verified (
ContextMenu.test.tsx:965). - Claim: one theme entry styles a menu's box and every flyout. Verified (the compiler writes one single-class rule, and the tests show the class on each box).
- Claim: no style changes, and the default look is byte-identical. Verified (the built core stylesheet is identical, 298,283 bytes after the rebase; the seven theme stylesheets are identical).
- Claim: the record lists seven targets, places the new one with its exclusions, and adds a pointer popup part. Verified (record FR2, FR24 and anatomy map;
DropdownMenu.doc.mjs:16,:150). - Claim: the popover record's optional surface target and the painted-element rules back the placement. Verified.
- Claim: the DOM gains only that class, the menu target stays where it was, and callers make no new decision. Verified (the diff adds no prop, style, attribute or default).
- Claim: moving the menu target onto the box and adding a popover prop were rejected. Consistent (neither appears).
- Claim: when the popover target and the new target set one property, the later theme entry wins. Verified (compiled rule order follows the theme object).
- Claim: a later part-ordering change marks the new target as sitting on the popover target. Not part of this pull request (nothing at this head or on the base branch declares it).
- Claim: the new tests cover the root box, a plain flyout, a flyout with header and footer, the ContextMenu case and the documented target. Verified (all five fail on the base and pass here).
- Claim: the theming-targets test and the DropdownMenu, ContextMenu, Popover and theme suites pass. Verified (2,483 tests at this head; the stated count predates the rebase).
- Claim: the probe-theme, knowledge and changeset checks, eslint and prettier pass. Verified.
- Claim: the record describes present behaviour and adds no open questions, history or status. Verified.
- Claim: one capability, no unrelated changes, docs and tests included, and no internal context in public text. Verified.
- Changeset: a menu's box and each flyout carry the new target, the menu target stays on the list, and under a ContextMenu only the flyouts carry it. Verified.
- File
.changeset/dropdown-menu-popup-target.md: clear. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear. - File
packages/core/src/ContextMenu/ContextMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.doc.mjs: non-blocking note (row radius). - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear. - File
packages/themes/probe/src/probeTheme.ts: clear (matches its generator).
rubyycheung
left a comment
There was a problem hiding this comment.
Design approved. Giving dropdown menus and their flyouts their own styling keeps menu borders, corners and shadows separate from other popovers. The default appearance stays unchanged; theme authors should set row corners separately when changing the outer box.
User need
A theme author cannot give menus their own box look. The box a user sees around a dropdown menu is the shared popover surface; the
dropdown-menutarget sits on the list inside it. A border, corners or shadow set ondropdown-menupaints a second box inside the real one, and setting them onpopoverrestyles every popover in the app (tooltips' cards, pickers, dialogs anchored to buttons). Sub-menu flyouts paint their own box, so even a theme that accepted that trade-off would get a root menu and its flyouts that disagree.Problem and solution fit
The floating box of a DropdownMenu and of each sub-menu flyout now carries a new
dropdown-menu-popuptarget:usePopover's existingsurfaceTargetoption, besidepopover(the same routeselector-popupandmulti-selector-popupuse);dropdown-menu(on the flyout's dialog frame when the sub-menu has a header or footer).Under a ContextMenu, sub-menu flyouts carry the target too (they are the same flyout), while the context menu's own box keeps only
context-menu. A theme styles a DropdownMenu's box and every sub-menu flyout with one entry:components: {'dropdown-menu-popup': {base: {borderRadius: '2px', boxShadow: 'none'}}}. No style changes: the default look is byte-identical.Current specification
component:DropdownMenuFR2 now lists seven local targets; FR24 (added here) says wheredropdown-menu-popupsits and where it does not (a drilled-in view, the touch sheet, a ContextMenu's own box). The anatomy map gains thePointer popuppart.component:Popover: an optional component surface target is how a composed component gets distinct theme reach on the surfaceusePopovercreates;popoverstays on that element.architecture:component-theming-surfaceINV4: the target sits on the element that paints; INV5: the menu's part on the shared popover surface keepspopoverbeside it.Public delta and caller burden
dropdown-menu-popup(classastryx-dropdown-menu-popup) in DropdownMenu'stheming.targets, and aPointer popupanatomy part.dropdown-menustays where it was.Design and alternatives
Rejected: moving
dropdown-menuonto the surface. Existing themes that style the list (padding, gap) would change. Rejected: a new prop or slot on Popover.surfaceTargetalready exists for exactly this.When a theme sets the same property on both
popoveranddropdown-menu-popup, the later entry in the theme object wins today, as it does forselector-popup. The open part-wins-over-component change gives parts that sit on another component's element a later layer; whichever of the two merges second marksdropdown-menu-popupas sitting onpopover, so the menu entry always wins.Evidence
DropdownMenu.test.tsx: the root menu's box is the popover surface carryingpopupandpopover, the list inside keepsdropdown-menuand notpopup, one box per menu; the target is listed in DropdownMenu's documented theming targets.DropdownMenuSubMenu.test.tsx: a plain flyout and a flyout with header and footer carry the target on the box; the sub-menu's list inside the frame does not.ContextMenu.test.tsx: the context menu's box keepscontext-menuwithout the new target; its sub-menu flyout carries it.themingTargets.test.tspasses with the new documented target.node scripts/build-css.mjson the base commit and on this head writes the samepackages/core/dist/astryx.cssbyte for byte (SHA-256 prefix9aa01792c3bec6bf, 296,793 bytes on both). The change adds markup only, and no Core rule reads it.Writing rubric results
R1 narration: none; FR24 and the anatomy row describe present behavior.
R2 research: none in the record; rejected alternatives are in this description only.
R3 evidence: the verification row names test files and cases, no pull request.
R4 rejected alternatives: none recorded.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.
Scope
Components: DropdownMenu, DropdownMenuSubMenu (and its flyouts under ContextMenu)
Testing
vitest run --project ui packages/core/src/DropdownMenu packages/core/src/ContextMenu packages/core/src/Popover packages/core/src/themepnpm visual:probe-theme:check,pnpm check:knowledge,node scripts/check-changesets.mjs, eslint and prettier on changed files.