Repository navigation
fix(Button, Popover, Dialog): keep an edge in forced-colors mode - #7677
Conversation
Forced colors removes fills and drops box-shadow. Solid Buttons are a fill with no border, and several floating surfaces are a shadow with no border, so under a contrast theme they lost their only edge. - Button: primary, secondary and destructive get a 1px solid ButtonText border under `@media (forced-colors: active)` (new forcedColorsEdge style, composed before xstyle). ghost stays flat. - usePopover surface: 1px solid CanvasText in forced colors. This covers Popover and DropdownMenu, whose menu sits inside that surface. - DropdownMenuSubMenu flyout and ContextMenu menu: same CanvasText border. - Dialog (and AlertDialog, which renders it) and the inline wrapper: the existing `border: none` becomes a conditional value with the same default, and a 1px CanvasText border in forced colors. A fullscreen dialog keeps no border. - Outside forced colors every computed border is unchanged, so layout is unchanged. Tests: two Chromium specs, Button.forcedColors.a11y.chromium.spec.ts and OverlayEdges.forcedColors.a11y.chromium.spec.ts, emulate forcedColors and assert all four border sides on each affected component, plus the unchanged paths (forced colors off, ghost, fullscreen dialog). 9 of 21 cases fail on a Storybook built from main and all 21 pass with this change. Adds a patch changeset for @astryxdesign/core.
|
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.
Thanks for restoring edges in forced-colors mode: standalone solid Buttons and the Popover, menu and Dialog surfaces now keep a visible border in forced colors and are unchanged outside it. One problem needs fixing before this can merge: the new Button edge is composed after ButtonGroup's divider styles (Button.tsx:722-742), so in the repository's Storybook (StyleX application-order) grouped primary, secondary and destructive buttons lose their 1px dividers even outside forced colors, and in the published CSS the first button of a connected group still has no leading edge in forced colors. Please compose the edge so the group's divider longhands still apply under both style resolutions and the first grouped solid button keeps a leading edge, then add a connected ButtonGroup case (horizontal and vertical, forced colors on and off) to Button.forcedColors.a11y.chromium.spec.ts.
[Automated review]
…rs (#9130) ## User impact A `DropdownMenu` whose trigger also has a tooltip (a custom trigger in `Tooltip`, or the default button's `tooltip`) rewrites that button's inline style on every render around it. The menu's anchor comes off and goes back, so `anchor-name` is rewritten and its two names swap order. A page that renders often never settles. We found it moving one app onto Astryx. ## Problem and solution fit - `DropdownMenu`'s trigger ref was a new function each render, so React called it again on every commit (`null`, then the element), moving the anchor each time. - Stabilizing those refs alone was not enough. They wrap `usePopover`'s `triggerRef`, keyed on the whole layer object, which changes whenever `onShow` or `onHide` does; `DropdownMenu`'s `onShow` changes with an inline `renderTrigger`, `onClick` or `onOpenChange`. That version still made 2 and 4 writes per render in the tests below. - So the fix is in the hook: ```ts const layerRef = layer.ref; const triggerRef = useCallback( (el: HTMLElement | null) => { triggerElementRef.current = el; layerRef(el); }, [layerRef], ); ``` The callback reads nothing else from the layer, and `layer.ref` (`useLayer`'s anchor callback, keyed on the anchor name and anchor-clearance option) reads only refs, so nothing goes stale. ## Expected behavior and authority Tooltip (#5951) and `useHoverCard` (#6606) got the same fix: a trigger ref keeps its identity when nothing about the trigger changes. No API or record changes. ## Smallest restoration - `usePopover`: `triggerRef` is keyed on `layer.ref` instead of `layer`. - `DropdownMenu`: stable refs on its three trigger paths, a custom trigger, the default button (still forwarding the caller's `ref`) and the bottom-sheet trigger. - Triggers that take `usePopover`'s ref directly get it stable too: ComplexSelector's built-in trigger, DateTimeInput's date field and Breadcrumbs. Not chosen: stabilizing each `DropdownMenu` callback instead, leaving every other `usePopover` caller churning. Also edited by open #7677 and #8550, both of which merge cleanly with this change. ## Evidence - Before (main eae5d92): one parent render writes the trigger's style 2 times with a custom trigger in `Tooltip`, and 4 times with the default button's `tooltip` and an inline `onOpenChange`. The two anchor names swap order, and `usePopover`'s `triggerRef` changes whenever `onShow` or `onHide` does. - After: 0 writes, the same order, the same ref. A caller's `ref` on the default button still gets the element. ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Testing How to check: 1. Render `<DropdownMenu button={{label: 'Actions', tooltip: 'More'}} onOpenChange={() => {}}>` inside a component that renders every second. 2. Watch the button's `style` attribute in the browser's Elements panel. Before: it flashes every second. After: it stays still. The new cases in `DropdownMenu.test.tsx` and `Popover.test.tsx` count the trigger's style writes with a MutationObserver. They fail on main and pass with the fix. Local gates at 08a5dc5: - The DropdownMenu, Popover, Tooltip and Layer suites, plus every other component that uses `usePopover`'s trigger ref (Breadcrumbs, Chat, ComplexSelector, DateInput, DateRangeInput, DateTimeInput, MultiSelector): 2,171 tests pass. The 6 new cases fail on main. - The DropdownMenu, Tooltip and Popover Chromium specs: 217 passed. - Core typecheck, ESLint with no warnings, Prettier, `pnpm check:repo` and the Storybook build. - `pnpm test:ui` and `pnpm test:node`: the same failures as on main, none in these components.
Dialog: main (meta#8120) already gives the modal surface a forced-colors border, so the modal keeps main's rule and the branch keeps only the isInline wrapper's border.
…he group closes its outer edge in forced colors The forced-colors edge was a border shorthand composed after ButtonGroup's divider longhands, so under StyleX application order grouped primary, secondary and destructive buttons lost their dividers outside forced colors, and in the published CSS the first grouped button had no leading edge. The edge now emits nothing outside forced colors. A standalone solid button takes the shorthand. A grouped one takes only the longhands its group does not own, plus a forced-colors leading edge on the first button. Destructive's own width and style move to the same edge, and it keeps its CanvasText color. The forced-colors spec adds connected horizontal, primary and vertical groups, with forced colors on and off. Both chromium specs now import from @astryxdesign/a11y-spec/playwright.
|
/approve-spec 395b944 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenu | 104.2 kB (+366 B) · 18.4 kB CSS (+483 B) | — | ✗ · ✓ · ✓ |
| Button · Storybook | 64.8 kB (+365 B) · 10.7 kB CSS (+381 B) | 798 (+103) | ✓ · ✓ · ✗ |
| DropdownMenuSubMenu | 74.3 kB (+31 B) · 10.1 kB CSS (0) | — | ✗ · ✓ · ✓ |
82 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenuCheckboxItem | 23.9 kB (0) · 7.0 kB CSS (0) | — | ✗ · ✓ · ✓ |
| DropdownMenuDivider | 5.3 kB (0) · 548 B CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuGroup | 6.4 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuItem | 23.1 kB (0) · 6.6 kB CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuRadioGroup | 6.6 kB (0) · 3.3 kB CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuRadioItem | 23.9 kB (0) · 7.0 kB CSS (0) | — | ✗ · ✓ · — |
| TableCell | 118.7 kB (+426 B) · 18.7 kB CSS (+474 B) | — | — · — · — |
| TableHeaderCell | 118.3 kB (+415 B) · 18.5 kB CSS (+460 B) | — | — · — · — |
| Selector | 109.8 kB (+438 B) · 18.3 kB CSS (+436 B) | — | — · — · — |
| MoreMenu | 104.5 kB (+390 B) · 18.4 kB CSS (+483 B) | — | — · — · — |
| Table | 135.6 kB (+413 B) · 19.2 kB CSS (+454 B) | — | — · — · — |
| TabMenu | 78.6 kB (+472 B) · 11.9 kB CSS (+394 B) | — | — · — · — |
| ContextMenu · Storybook | 117.5 kB (+444 B) · 18.2 kB CSS (+417 B) | 715 (+12) | ✓ · ✓ · ✓ |
| DateTimeInput | 222.9 kB (+441 B) · 19.6 kB CSS (+418 B) | — | — · — · — |
| Typeahead | 87.4 kB (+459 B) · 13.2 kB CSS (+394 B) | — | — · — · — |
| PowerSearch | 305.9 kB (+388 B) · 25.1 kB CSS (+439 B) | — | — · — · — |
| SideNav | 120.6 kB (+428 B) · 12.1 kB CSS (+396 B) | — | — · — · — |
| BreadcrumbItem | 91.5 kB (+435 B) · 12.9 kB CSS (+387 B) | — | — · — · — |
| ComplexSelector | 77.3 kB (+431 B) · 12.6 kB CSS (+391 B) | — | — · — · — |
| DateRangeInput | 99.1 kB (+426 B) · 13.3 kB CSS (+385 B) | — | — · — · — |
| Lightbox | 145.1 kB (+413 B) · 11.9 kB CSS (+394 B) | — | — · — · — |
| Pagination | 120.9 kB (+370 B) · 18.7 kB CSS (+435 B) | — | — · — · — |
| Tokenizer | 103.5 kB (+407 B) · 19.9 kB CSS (+398 B) | — | — · — · — |
| Markdown | 198.6 kB (+382 B) · 21.5 kB CSS (+417 B) | — | — · — · — |
| FileInput | 73.9 kB (+409 B) · 11.7 kB CSS (+386 B) | — | — · — · — |
| BaseTypeahead | 78.1 kB (+401 B) · 11.7 kB CSS (+390 B) | — | — · — · — |
| TopNavHeading | 81.9 kB (+402 B) · 12.0 kB CSS (+389 B) | — | — · — · — |
| ChatLayout | 88.1 kB (+387 B) · 11.3 kB CSS (+400 B) | — | — · — · — |
| TextInput | 72.5 kB (+394 B) · 11.9 kB CSS (+390 B) | — | — · — · — |
| TopNav | 77.4 kB (+385 B) · 11.7 kB CSS (+399 B) | — | — · — · — |
| DialogHeader | 67.7 kB (+379 B) · 12.3 kB CSS (+401 B) | — | ✓ · ✓ · ✓ |
| MultiSelector | 101.1 kB (+375 B) · 17.6 kB CSS (+405 B) | — | — · — · — |
| TopNavMegaMenu | 75.8 kB (+392 B) · 12.6 kB CSS (+388 B) | — | — · — · — |
| SideNavHeading | 82.2 kB (+398 B) · 12.0 kB CSS (+380 B) | — | — · — · — |
| Toast | 103.1 kB (+382 B) · 11.0 kB CSS (+393 B) | — | — · — · — |
| Calendar | 75.9 kB (+386 B) · 11.3 kB CSS (+387 B) | — | — · — · — |
| CodeBlock | 80.0 kB (+360 B) · 12.0 kB CSS (+411 B) | — | — · — · — |
| AppShell | 97.0 kB (+367 B) · 14.2 kB CSS (+403 B) | — | — · — · — |
| MobileNavToggle | 65.2 kB (+388 B) · 10.7 kB CSS (+381 B) | — | — · — · — |
| TimeInput | 174.2 kB (+387 B) · 16.8 kB CSS (+379 B) | — | — · — · — |
| TopNavMenu | 81.3 kB (+391 B) · 12.0 kB CSS (+375 B) | — | — · — · — |
| MobileNav | 75.7 kB (+365 B) · 11.4 kB CSS (+399 B) | — | — · — · — |
| DateInput | 199.4 kB (+367 B) · 17.8 kB CSS (+396 B) | — | — · — · — |
| ChatComposer | 84.3 kB (+382 B) · 12.8 kB CSS (+380 B) | — | — · — · — |
| ChatSendButton | 65.2 kB (+378 B) · 10.7 kB CSS (+382 B) | — | — · — · — |
| Banner | 66.8 kB (+376 B) · 11.2 kB CSS (+383 B) | — | — · — · — |
| SideNavItem | 76.8 kB (+379 B) · 11.9 kB CSS (+378 B) | — | — · — · — |
| Thumbnail | 69.2 kB (+371 B) · 12.3 kB CSS (+385 B) | — | — · — · — |
| NumberInput | 77.3 kB (+368 B) · 12.2 kB CSS (+387 B) | — | — · — · — |
| Stepper | 66.5 kB (+369 B) · 10.9 kB CSS (+385 B) | — | — · — · — |
| Carousel | 74.5 kB (+356 B) · 11.7 kB CSS (+397 B) | — | — · — · — |
| ToggleButton | 91.8 kB (+376 B) · 10.8 kB CSS (+375 B) | — | — · — · — |
| ChatComposerInput | 81.9 kB (+366 B) · 12.0 kB CSS (+384 B) | — | — · — · — |
| ChatComposerTokenElement | 81.9 kB (+366 B) · 12.0 kB CSS (+384 B) | — | — · — · — |
| DrawerHeader | 67.8 kB (+349 B) · 13.7 kB CSS (+398 B) | — | — · — · — |
| ChatDictationButton | 65.4 kB (+361 B) · 10.8 kB CSS (+385 B) | — | — · — · — |
| ChatLayoutScrollButton | 65.4 kB (+358 B) · 10.9 kB CSS (+388 B) | — | — · — · — |
| SideNavCollapseButton | 65.7 kB (+360 B) · 10.8 kB CSS (+383 B) | — | — · — · — |
| TableSelectionToolbar | 75.0 kB (+343 B) · 14.0 kB CSS (+399 B) | — | — · — · — |
| Popover · Storybook | 97.6 kB (+346 B) · 15.0 kB CSS (+393 B) | 1,552 (+12) | ✓ · ✓ · ✓ |
| IconButton | 64.9 kB (+356 B) · 10.7 kB CSS (+381 B) | — | — · — · — |
| AlertDialog | 111.3 kB (+353 B) · 15.3 kB CSS (+374 B) | — | — · — · — |
| Timestamp | 35.8 kB (+1 B) · 11.0 kB CSS (+389 B) | — | — · — · — |
| CommandPalette | 76.3 kB (+3 B) · 12.7 kB CSS (0) | — | — · — · — |
| Dialog | 25.3 kB (+1 B) · 6.9 kB CSS (0) | — | ✓ · ✓ · — |
| ContextMenuItem | 33.7 kB (0) · 6.8 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 112.6 kB (new) · 773 B CSS (new) | — | — · — · — |
| lab/ChatReactionBar | 113.7 kB (new) · 1.1 kB CSS (new) | — | — · — · — |
| lab/CommentComposer | 158.9 kB (new) · 1.9 kB CSS (new) | — | — · — · — |
| lab/Comments | 367.4 kB (new) · 2.5 kB CSS (new) | — | — · — · — |
| lab/CommentThread | 360.6 kB (new) · 2.4 kB CSS (new) | — | — · — · — |
| lab/DialogHeroHeader | 88.3 kB (new) · 372 B CSS (new) | — | — · — · — |
| lab/DiffViewer | 92.7 kB (new) · 2.1 kB CSS (new) | — | — · — · — |
| lab/EmojiPicker | 92.2 kB (new) · 751 B CSS (new) | — | — · — · — |
| lab/ListInput | 93.3 kB (new) · 922 B CSS (new) | — | — · — · — |
| lab/Schedule | 114.4 kB (new) · 3.9 kB CSS (new) | — | — · — · — |
| lab/TourStep | 92.8 kB (new) · 691 B CSS (new) | — | — · — · — |
| lab/TransferList | 107.5 kB (new) · 1.2 kB CSS (new) | — | — · — · — |
| lab/TransferListSelector | 116.4 kB (new) · 1.4 kB CSS (new) | — | — · — · — |
| richtext/RichTextEditor | 304.1 kB (new) · 2.6 kB CSS (new) | — | — · — · — |
| richtext/RichTextEditorToolbar | 297.8 kB (new) · 454 B CSS (new) | — | — · — · — |
| richtext/RichTextView | 281.8 kB (new) · 2.3 kB CSS (new) | — | — · — · — |
Visual changes: 5 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: unknown (base surface unavailable): richtext, theme-butter, theme-chocolate, theme-gothic, theme-matcha, theme-neutral, theme-stone, theme-y2k
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Thanks for the forced-colors work: grouped buttons now keep their dividers, and solid Buttons, connected groups and the popover, menu and inline Dialog surfaces gain a visible edge in contrast themes. Two things need fixing before this can merge:
- The standalone edge's
nulldefaults (packages/core/src/Button/Button.tsx:649-650) replace Button's ownborder-width: 0andborder-style: none, so in an app that does not load@astryxdesign/core/reset.cssevery standaloneprimary,secondaryanddestructiveButton shows the browser's 2px outset border with forced colors off; restoringdefault: 0anddefault: 'none'there fixes it, and the "gains no border" cases should also assertborder-style: none. - Regression:
mainhas since givendestructiveButtons and the modal Dialog and AlertDialog their forced-colors border, so the changeset's "solidButtonvariants (primary,secondary,destructive) keep aButtonTextborder ... which left these controls and surfaces without an edge" and the description's User impact now describe working behavior as broken; the changeset should say thatprimaryandsecondarygain aButtonTextborder anddestructivekeeps itsCanvasTextone.
The earlier ButtonGroup divider problem is fixed under both StyleX style resolutions.
[Automated review]
…tside forced colors The standalone edge's border keys replace the base's own, so null defaults left no declaration and an app without the reset stylesheet showed the browser's button border. The defaults now repeat the base's values. The 'gains no border' cases also assert border-style none. The changeset says primary and secondary gain a ButtonText border and destructive keeps its CanvasText one. The edge sits above the comment that explains variants[variant].
|
/approve-spec 21e2fe9 |
There was a problem hiding this comment.
Changes requested: the forced-colors edges on solid Buttons, connected ButtonGroups and the Popover, DropdownMenu, submenu, ContextMenu and inline Dialog surfaces are owner-approved and behave as described in the default theme, but one theme defeats the Button edge and one change leaks outside forced colors.
- Miss: the Gothic theme's
button'variant:secondary'override setsborderWidth: '0'(packages/themes/gothic/src/gothicTheme.ts:64-69, applied at:252), and theme rules outrank the new forced-colors1px, so with Gothic in forced colors everysecondaryButton still computes0pxon all sides while AR7 and the changeset saysecondarygains a border; keep Gothic's zero width out of forced colors (or drop it from the Button override) and add a Gothic forced-colors case, or state the theme exception in AR7 and the changeset. - Miss:
usePopover.tsx:103-110,ContextMenu.tsx:168-175andDropdownMenuSubMenu.tsx:216-223giveborderWidthandborderStylethe defaults0and'none', so under Astryx's reset (which setsborder-style: solidso that a border needs only a width) a border an app or theme adds to these surfaces withborder-widthalone shows on main and disappears here, and the changeset's "nothing changes elsewhere" is not true; usedefault: nullfor those two keys, asborderColoralready does.
Non-blocking: a grouped solid Button's first-member leading edge still declares no forced colour, and a solid Button used as a direct InputGroup addon doubles the seam in forced colors. Both Chromium specs pass on this branch and fail on main in exactly the nine cases the description lists; CI has not run on this head.
Claims and files checked
- Changeset:
primaryandsecondarygain aButtonTextborder in forced colors: verified in the default theme (Button.tsx:652-657; Chromium spec); false under the Gothic theme, wheresecondarystays at0px. - Changeset:
destructivekeeps itsCanvasTextborder: verified standalone and on a grouped member's cross and trailing edges (Button.tsx:329-332,:719-726,:735-742; the unit test fails on the commit before the fix and passes here). - Changeset: grouped solid buttons keep the dividers and close the outer edge with no doubled seam: verified (
Button.tsx:658-703; Chromium group cases). - Changeset:
Popover, every surfaceusePopoverpaints, submenu flyouts, ContextMenu and an inline Dialog gain aCanvasTextborder: verified (usePopover.tsx:103-114,DropdownMenuSubMenu.tsx:216-227,ContextMenu.tsx:168-179,Dialog.tsx:325-336). - Changeset: forced colors removes fills and box shadows, leaving these without an edge: verified (no border on main in forced colors).
- Changeset: the borders exist only in forced colors, so nothing changes elsewhere: the first half verified; "nothing changes elsewhere" false for the
usePopoversurface, ContextMenu and submenu flyout, which now setborder-style: noneoutside forced colors. - Description: solid variants are a fill with no border, and a group of them keeps only its dividers on main: verified (
Button.tsx:125-126; probes). - Description:
destructive, the modal Dialog and AlertDialog already keep a forced-colors border on main: verified (those spec cases pass on main). - Description: the popover and menu surfaces have no border and the inline wrapper
0/noneon main: verified. - Description: an app had to work around this with forced-colors rules on the stable classes: context, not checkable here.
- Description: the fix follows the nested media-query pattern of CheckboxIndicator and NavItem: verified (
CheckboxIndicator.tsx:103,navItemStyles.stylex.ts:91). - Description: a standalone button keeps
0/none, a grouped one repeats the divider and closes the first and last edges,ghoststays flat, and the edge sits beforexstyle: verified (Button.tsx:652-703,:981-1000). - Description:
destructive's own forced-colors width and style move into the shared edge: verified (Button.tsx:322-333). - Description: outside forced colors the computed border is unchanged (
0/none), so nothing shifts in layout: layout verified (frames identical); the computed border is false for the three surfaces above, which compute0 solidon main under the reset. - Description: in forced colors a content-sized button or surface grows by the 1px border: consistent with the styles.
- Description: no new API, prop, token or default: verified (the API report shows no change).
- Description: before the change the listed elements compute no border in forced colors, and all four sides compute 1px solid after: verified in Chromium on both branches.
- Description: a fullscreen Dialog stays edgeless and fits the viewport: verified (spec case).
- Description: 27 browser cases, 9 failing on main and all passing here: verified against Storybook builds of main and this branch.
- Description: each spec checks that forced colors are active before measuring: verified.
- Description:
secondaryhas no border on main in the base theme, and a theme's or app's own border stays: verified for themes that add a border; the Gothic theme removes the new one (first finding). - Description: vitest for the nine named folders passes: verified (every test passes); the 749 count is not reproduced (the folders hold 1142 tests on this branch).
- Description: core typecheck passes: verified.
- Description: strict ESLint over the touched component folders is clean: verified (0 errors on the changed files).
- Description: the repository checks of the strict lint: the comment-provenance baseline and the knowledge check pass; the full repository check was not rerun.
- Description: a merge of
mainand six commits on top, four records and wording, one code fix and one comment fix: verified. - Description: AR7, FR10 and their verification rows match the records: verified (
Button.spec.md:220-227,:301;Popover.spec.md:204,:381). - Description: the grouped
destructivecolour fix and its unit test, failing before the fix: verified (2 of 3 fail on the commit before it; 3 of 3 pass here). - Description: Button and ButtonGroup unit tests pass with no eslint errors and clean prettier: verified.
- Description: the writing rubric results match the records: verified.
- Files:
.changeset/in-forced-colors-mode-solid-button-variants-prim-xlw3.mdfinding (both claims above);docs/specs/components/Button/Button.spec.mdclear;docs/specs/components/Popover/Popover.spec.mdclear;packages/core/src/Button/Button.tsxnon-blocking notes;packages/core/src/Button/Button.forcedColorsEdge.test.tsxclear;packages/core/src/Button/__tests__/Button.forcedColors.a11y.chromium.spec.tsclear;packages/core/src/Popover/__tests__/OverlayEdges.forcedColors.a11y.chromium.spec.tsclear;packages/core/src/Popover/usePopover.tsxfinding;packages/core/src/ContextMenu/ContextMenu.tsxfinding;packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsxfinding;packages/core/src/Dialog/Dialog.tsxclear.
…no border outside forced colors The popover surface, the ContextMenu surface and submenu flyouts leave border width and style unset outside forced colors, as their colour already was, so a caller's width-only border keeps showing under the reset. A unit test reads the surface's rules outside any media query; it failed on 3945797. FR10 says the edge sets nothing outside forced colors. The four surface comments keep only the reason. Co-authored-by: ejc3 <[email protected]>
|
/approve-spec bd62d4b |
There was a problem hiding this comment.
Changes requested: the forced-colors edges on solid Buttons, connected ButtonGroups and the Popover, DropdownMenu, submenu, ContextMenu and inline Dialog surfaces are owner-approved and behave as described in the default theme, and the width-only-border regression from the last round is fixed, but one shipped theme still defeats the Button edge.
- Miss: the Gothic theme's
button'variant:secondary'override setsborderWidth: '0'(packages/themes/gothic/src/gothicTheme.ts:64-69, applied at:252), and theme rules outrank the new forced-colors1px, so with Gothic in forced colors everysecondaryButton still computes0pxon all four sides while AR7 and the changeset saysecondarygains a border; give Gothic's Button override its own object without the zero width (Button already draws no border outside forced colors) and add a Gothic forced-colors case, or name the theme exception in AR7 and the changeset.
Non-blocking: a grouped destructive Button's leading edge still declares no forced colour, a solid Button used as a direct InputGroup addon doubles its seam in forced colors, and the JSDoc above FORCED_COLORS overstates which longhands a grouped button leaves null. Both Chromium specs pass on this branch and fail on main in exactly the nine cases the description lists.
Claims and files checked
- Changeset:
primaryandsecondaryButtons gain aButtonTextborder in forced colors: verified in the default theme (Button.tsx:651-656; Chromium spec); false with the Gothic theme, wheresecondarystays at0px. - Changeset:
destructivekeeps itsCanvasTextborder: verified standalone (Button.tsx:329-332) and on a grouped member's cross and trailing edges (:718-741; the unit test fails on the commit before that fix and passes here). - Changeset: grouped solid buttons keep the dividers and close the group's outer edge with no doubled seam: verified (
Button.tsx:658-703; Chromium group cases). - Changeset:
Popover, every surfaceusePopoverpaints, submenu flyouts, ContextMenu and an inline Dialog gain aCanvasTextborder: verified (usePopover.tsx:101-112,DropdownMenuSubMenu.tsx:214-225,ContextMenu.tsx:166-177,Dialog.tsx:323-334; browser probes). - Changeset: forced colors removes fills and box shadows, leaving these without an edge: verified (no border on main in forced colors).
- Changeset: the borders exist only in forced colors, so nothing changes elsewhere: verified (frames outside forced colors are identical; a width-only border on the Popover surface still computes
3px solid; the surface unit test). - Description: solid variants are a fill with no border, and a connected group of them keeps only its dividers on main: verified (browser probes on main).
- Description:
destructive, the modal Dialog and AlertDialog already keep a forced-colors border on main: verified (those spec cases pass on main). - Description: the popover and menu surfaces have a shadow-only edge and the inline wrapper
0/noneon main: verified. - Description: an app had to work around this with forced-colors rules on the stable classes: context, not checkable here.
- Description: the fix follows the nested media-query pattern of CheckboxIndicator and NavItem: verified (
CheckboxIndicator.tsx:103,navItemStyles.stylex.ts:91). - Description: a standalone button keeps
0/none, a grouped one repeats the divider and the first and last close the group,ghoststays flat, and the edge sits beforexstyle: verified (Button.tsx:651-703,:981-1000). - Description:
destructive's own forced-colors width and style move into the shared edge: verified (Button.tsx:322-332). - Description: the shared surface covers Popover, DropdownMenu and the other surfaces
usePopoverpaints: verified. - Description: the modal Dialog keeps main's border and a fullscreen Dialog stays edgeless: verified (fullscreen spec case passes).
- Description: outside forced colors the computed border is unchanged, so nothing shifts in layout: verified; the three surfaces compute
0 solid(the reset's style) on both branches rather than0 / none. - Description: in forced colors a content-sized button or surface grows by the 1px border: verified (probe boxes grow by 1-2px).
- Description: no new API, prop, token or default: verified (the API surface comparison lists no change).
- Description: before the change the listed elements compute no border in forced colors, and after it all four sides compute
1px solid: verified in Chromium on both branches; box-shadow was not measured. - Description: forced colors off adds no border,
ghoststays borderless and a fullscreen Dialog does not overflow: verified (spec cases pass). - Description: 27 browser cases, 9 failing on main and all passing here: verified against Storybook builds of main and this branch.
- Description: each spec checks that forced colors are active before measuring: verified.
- Description: a theme's or app's own border on
secondarystays: verified for themes that add a border; the Gothic theme removes the new one (finding). - Description: Button and ButtonGroup unit tests pass (226) and Popover, ContextMenu, DropdownMenu and Dialog unit tests pass (758): verified; the earlier 749 figure is superseded by these.
- Description: core typecheck, strict ESLint on the touched files and prettier are clean: verified (all three pass here).
- Description: a merge of
mainand seven commits on top (four record and wording, two code fixes, one comment fix): verified. - Description: AR7, FR10 and their verification rows read as stated, with states, failure expectations and audit sections: verified (
Button.spec.md:220-227,:301;Popover.spec.md:204,:381). - Description: the grouped
destructivecolour test failed before its fix and passes now: verified (2 of 3 fail before; 3 of 3 pass here). - Description: the three surfaces now set no border width or style outside forced colors, the inline wrapper keeps
0/none, and the surface test failed on the previous commit: verified (it fails there withborder-width:0pxandborder-style:none, and passes here). - Description: the writing rubric results match the records: verified.
- Files:
.changeset/in-forced-colors-mode-solid-button-variants-prim-xlw3.md: finding (thesecondaryclaim under Gothic) - Files:
docs/specs/components/Button/Button.spec.md: finding (AR7 does not hold under Gothic); otherwise clear - Files:
docs/specs/components/Popover/Popover.spec.md: clear - Files:
packages/core/src/Button/Button.tsx: non-blocking notes - Files:
packages/core/src/Button/Button.forcedColorsEdge.test.tsx: clear - Files:
packages/core/src/Button/__tests__/Button.forcedColors.a11y.chromium.spec.ts: clear (default theme only) - Files:
packages/core/src/Popover/__tests__/OverlayEdges.forcedColors.a11y.chromium.spec.ts: clear - Files:
packages/core/src/Popover/usePopover.forcedColorsEdge.test.tsx: clear - Files:
packages/core/src/Popover/usePopover.tsx: clear - Files:
packages/core/src/ContextMenu/ContextMenu.tsx: clear - Files:
packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clear - Files:
packages/core/src/Dialog/Dialog.tsx: clear
…iant's border width keeps it Co-authored-by: ejc3 <[email protected]>
|
/approve-spec bb8d8ea |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is a draft.
primary and secondary Buttons, connected ButtonGroups and the Popover, DropdownMenu, submenu, ContextMenu and inline Dialog surfaces now keep a 1px system-colour edge in forced colors, and nothing changes outside forced colors. Button AR7 and Popover FR10 have an engineering owner's approval for this head, and AR7 and the changeset now state that a theme which sets its own Button border width, such as Gothic for secondary, keeps it. Three non-blocking notes stay open on their existing threads: the first grouped destructive button's leading-edge colour, a 2px seam on an InputGroup Button addon, and the JSDoc above FORCED_COLORS.
Claims and files checked
- Changeset:
primaryandsecondaryButtons gain aButtonTextborder in forced colors — verified (Button.tsx:654-656,:710-716; browser spec). - Changeset:
destructivekeeps itsCanvasTextborder — verified (Button.tsx:329-332,:719-742; unit test), apart from the first grouped member's new leading side (non-blocking note). - Changeset: a connected ButtonGroup keeps its dividers and closes its outer edge with no doubled seam — verified (
Button.tsx:658-703; group spec cases). - Changeset: the Popover surface and every surface
usePopoverpaints, the submenu flyout, ContextMenu and an inline Dialog gain aCanvasTextborder — verified (usePopover.tsx:100-112, applied at:691;ContextMenu.tsx:165-177;DropdownMenuSubMenu.tsx:213-225;Dialog.tsx:322-334). - Changeset: forced colors removed the only edge these had — verified (the nine new browser cases fail against the base).
- Changeset: the borders exist only in forced colors — verified (frames with forced colors off are pixel-identical; outside-forced-colors spec cases; surface unit test).
- Changeset: a theme that sets a solid variant's own border width keeps it, so Gothic's
secondaryButton stays borderless — verified (gothicTheme.ts:64-69,:252; Gothic probe). - Description: on main 9 of the 27 browser cases fail and all 27 pass here — verified (base run: 9 failed, 18 passed; head: 27 passed).
- Description: each spec first checks that the page is in forced colors — verified (both specs'
matchMediaassertion). - Description: no new API, prop, token or default — verified (API surface comparison: no rows).
- Description: standalone buttons keep
0/noneoutside forced colors, grouped buttons repeat the divider and the first and last close the edge, and the edge composes beforexstyle— verified (Button.tsx:654-703,:981-1000). - Description: the modal Dialog and AlertDialog already keep a border and a fullscreen Dialog stays edgeless — verified (
Dialog.tsx:207-218; fullscreen spec case). - Description: the three surfaces set no border width or style outside forced colors, and the grouped
destructivecolour lives in its own longhands — verified (usePopover.forcedColorsEdge.test.tsx;Button.forcedColorsEdge.test.tsx, whose groupedprimarycase fails on the base). - Description: the unit suites for the touched components pass — verified (1,143 tests).
- Description: the Gothic gap is filed for a theme-level capability — not checkable from the repository; nothing depends on it.
- Files: the changeset,
Button.spec.md,Popover.spec.md,Button.forcedColorsEdge.test.tsx,Button.forcedColors.a11y.chromium.spec.ts,ContextMenu.tsx,Dialog.tsx,DropdownMenuSubMenu.tsx,OverlayEdges.forcedColors.a11y.chromium.spec.ts,usePopover.forcedColorsEdge.test.tsxandusePopover.tsx— clear. - Files:
Button.tsx— non-blocking notes only (leading-edge colour of a first groupeddestructive, InputGroup addon seam, JSDoc placement).
|
/approve-spec 669791a |
There was a problem hiding this comment.
Approved pending CI: required CI checks were still running on this head at review time.
Solid primary and secondary Buttons, connected ButtonGroups and the Popover, DropdownMenu, submenu flyout, ContextMenu and inline Dialog surfaces now keep a 1px system-colour edge in forced colors, and nothing changes outside forced colors. Button AR7 and Popover FR10 carry an engineering owner's approval for this head, and the browser specs fail the nine fixed cases on main and pass all 27 here. Three non-blocking notes stay open on their existing threads: the 2px seam on an InputGroup Button addon, the leading-edge colour of a first grouped destructive Button, and the JSDoc above FORCED_COLORS.
Claims and files checked
- Changeset:
primaryandsecondaryButtons gain aButtonTextborder in forced colors — verified (Button.tsx:651-657; browser spec). - Changeset:
destructivekeeps itsCanvasTextborder — verified (Button.tsx:329-332; browser spec on both trees; unit test), apart from the first grouped member's leading side (non-blocking note). - Changeset: a connected ButtonGroup keeps its dividers and closes its outer edge with no doubled seam — verified (
Button.tsx:658-703; three group stories). - Changeset: the Popover surface and every surface
usePopoverpaints, the submenu flyout, ContextMenu and an inline Dialog gain aCanvasTextborder — verified (usePopover.tsx:100-112;ContextMenu.tsx:165-177;DropdownMenuSubMenu.tsx:213-225;Dialog.tsx:316-334). - Changeset: forced colors removed the only edge these had — verified (nine browser cases fail on
main). - Changeset: the borders exist only in forced colors — verified (frames with forced colors off are pixel-identical; outside-forced-colors cases; surface unit test).
- Changeset: a theme that sets a solid variant's own border width keeps it, so Gothic's
secondarystays borderless — verified (gothicTheme.ts:64-69, applied at:252). - Description: solid Buttons are a fill with no border and a group keeps only its dividers on
main— verified (baseButton.tsx:125-126; computed borders on the base). - Description: the fix follows the existing forced-colors pattern of
CheckboxIndicatorandNavItem— verified. - Description: standalone buttons keep
0/noneoutside forced colors, grouped buttons repeat the divider, the first and last close the edge,ghoststays flat, and the edge composes beforexstyle— verified (Button.tsx:651-703,:981-1000). - Description: the modal Dialog and AlertDialog already keep a border and a fullscreen Dialog stays edgeless and fits — verified (
Dialog.tsx:207-218,:270-280; fullscreen case). - Description: no new API, prop, token or default — verified (API surface comparison: no rows).
- Description: 9 of the 27 browser cases fail on
mainand all 27 pass here — verified. - Description: each spec first checks that the page is in forced colors — verified.
- Description: the unit suites for the touched components pass, and lint and typecheck are clean — verified (1,089 tests; CI lint and typecheck pass).
- Description: the maintainer round is a merge of
mainand eight commits (five record or wording, two code fixes, one comment fix) — verified (commit list). - Description: AR7, FR10 and their verification rows name the specs, states, failure expectations and audit sections — verified (
Button.spec.md:220-228,:302;Popover.spec.md:204,:381). - Description: the grouped
destructivecolour lives in its own longhands and a unit test reads both orientations — verified (Button.tsx:706-743; test passes). - Description: the three surfaces leave border width and style unset outside forced colors and the inline Dialog keeps
0/none— verified (surface unit test passes). - Description: the Gothic gap is filed, and an app worked around the defect — not checkable from the repository; nothing depends on them.
- Files: the changeset,
Button.spec.md,Popover.spec.md,Button.forcedColorsEdge.test.tsx,Button.forcedColors.a11y.chromium.spec.ts,ContextMenu.tsx,Dialog.tsx,DropdownMenuSubMenu.tsx,OverlayEdges.forcedColors.a11y.chromium.spec.ts,usePopover.forcedColorsEdge.test.tsxandusePopover.tsx— clear. - Files:
Button.tsx— non-blocking notes only (InputGroup addon seam, first groupeddestructiveleading-edge colour, JSDoc placement).















User impact
In forced-colors mode (Windows contrast themes; Chromium's
forcedColors: 'active'emulation), the system replaces author colors and dropsbox-shadow. Two groups of components rely on exactly those two things for their edge and lose it:Buttonwithvariant="primary"or"secondary"is a fill withborder: none. The fill is removed, so the button reads as plain text with no boundary. In a connectedButtonGroupof such buttons only the dividers remain, with no outer edge. (destructivealready keeps aCanvasTextborder onmain, and keeps it here.)Popover(and every surfaceusePopoverpaints, includingDropdownMenu),DropdownMenuSubMenuflyouts,ContextMenu, and anisInlineDialogseparate from the page with a box-shadow only. The shadow is dropped and the surface runs straight into what is under it. (The modalDialogandAlertDialogalready keep a border onmain.)People using a contrast theme cannot see where these controls and surfaces begin or end (WCAG 1.4.11, non-text contrast). An app that hit this had to work around it with
@media (forced-colors: active)rules targeting the stableastryx-*classes.Problem and solution fit
Why it happens: the styles set
border-width: 0; border-style: none(Button, the inline Dialog wrapper) or no border at all (popover and menu surfaces) and draw the edge with a fill or shadow, both of which forced colors discards.Why it harms: with the edge gone, hit areas and surface bounds are not perceivable.
Why it matters: these are the primary action and the surfaces that hold actions.
The fix follows the repo's existing forced-colors pattern (
@media (forced-colors: active)nested in the StyleX property, as inCheckboxIndicatorandNavItem).Smallest restoration
All changes are in StyleX styles and take effect only under
@media (forced-colors: active):Button.tsx: aforcedColorsEdgestyle givesprimary,secondaryanddestructivea1px solid ButtonTextedge;destructivekeeps its existingCanvasTextcolor. A standalone button takes the border shorthand, which keeps the base's0/noneoutside forced colors. In a connectedButtonGroup, a button sets its cross edges (block edges in a horizontal group, inline edges in a vertical one) and the group's last edge only in forced colors, withnulloutside them. It repeats the group's leading divider width and style, with the first button taking a forced-colors leading edge: the group's dividers stay where they are under both StyleX style resolutions, and its first and last buttons close the outer edge with no doubled seam.destructive's own forced-colors width and style move into this shared edge.ghostis flat by design and keeps no border. It is composed beforexstyle, so a caller can still override it.usePopover.tsx: the shared popoversurfacegets1px solid CanvasText. This coversPopoverandDropdownMenu(its menu sits inside this surface), and the otherusePopoversurfaces, which have the same shadow-only edge.DropdownMenuSubMenu.tsx: the flyout menu, which paints its own shadow.ContextMenu.tsx: the menu surface.Dialog.tsx: theisInlinewrapper.mainalready gives the modal<dialog>(and soAlertDialog) a forced-colors border and keeps a fullscreen dialog edgeless, so this branch keeps main's rule there.@astryxdesign/core.Outside forced colors the computed border is unchanged (
0/none), so nothing shifts in layout. In forced colors a surface or button grows by the 1px border where it usescontent-boxor content-sized width, which is the cost of having an edge.No new API, prop, token or default.
Evidence
forcedColors: 'active', every one of these computesborder-style: noneorborder-width: 0on its top edge (the specs read all four sides):primaryandsecondarybuttons; theDropdownMenusurface; a submenu flyout;ContextMenu; anisInlineDialog;Popover. Theirbox-shadowcomputes tonone.destructiveand the modalDialogandAlertDialogalready keep a border onmain, and the specs check that they still do.solidborder of 1px.ghostbuttons stay borderless in both modes; a fullscreenDialoghas no border and does not overflow the viewport.mainand one built from this branch: onmain, 9 of the 27 cases fail. They are theprimaryandsecondaryborders, the three connected-group outer edges, and the DropdownMenu, submenu, ContextMenu and Popover borders;destructiveand the modal Dialog already pass onmain. On this branch all 27 pass. The connected-group cases cover horizontal, primary and vertical groups: outside forced colors each button after the first keeps a 1px divider and no other edge; in forced colors every button has the leading divider and both cross edges, and only the last has a trailing edge.Note on
secondary: its computed border is alsononeonmainin the base theme, so it is included. If a theme or an app styles a border onto it, that stays; the forced-colors border applies only under the media query and loses toxstyle.Scope
Testing
Added two Chromium specs (they build on the checked-in stories, as the other
*.a11y.chromium.spec.tsfiles do):packages/core/src/Button/__tests__/Button.forcedColors.a11y.chromium.spec.tspackages/core/src/Popover/__tests__/OverlayEdges.forcedColors.a11y.chromium.spec.tsEach spec asserts the page really is in forced colors (
matchMedia('(forced-colors: active)')) before measuring, so a failed emulation cannot pass silently.Also run:
vitestfor Button, ButtonGroup, ToggleButton, IconButton, Dialog, AlertDialog, DropdownMenu, ContextMenu and Popover: 749 tests pass.pnpm -F @astryxdesign/core typecheck.pnpm lint:strict. Its full ESLint pass was not run clean here, because it also read a locally generated Storybook build.Maintainer round (records)
A merge of
mainand eight commits on top (five record and wording commits, two code fixes and one comment fix); the commits above are unchanged.component:PopoverFR10: under forced colors the surface keeps a 1 pxCanvasTextedge. Every surfaceusePopoverpaints, DropdownMenu's included, does the same; the ContextMenu surface and DropdownMenuSubMenu flyouts paint their own surface and keep the same border. Outside forced colors the edge sets no border width, style or colour, so each surface keeps its own border or a caller's.component:ButtonAR7: under forced colors a solid variant keeps a 1 px system-colour border,ButtonTextorCanvasTextondestructive(architecture:theme-tokensINV11). A ButtonGroup keeps its dividers and closes its outer edge,ghoststays borderless, and no border is added outside forced colors.component:Dialog, not FR10.destructive): a grouped button's forced-colors edge colour now lives in its own longhand styles,CanvasTextfordestructiveandButtonTextfor the others. Before, the group edge'sButtonTextlonghands could win overdestructive'sCanvasTextshorthand in a build that orders longhands after shorthands (the published CSS), though the Storybook build hid it.Button.forcedColorsEdge.test.tsxreads the injected forced-colors rules for a groupeddestructiveButton in both orientations and a groupedprimaryButton in a horizontal group; it failed on the previous head (aButtonTextedge on the destructive button) and passes now. Button and ButtonGroup unit tests pass (226), with no eslint errors and clean prettier.Writing rubric results
Run over the Popover FR10 and Button AR7 lines and their verification rows:
border-width: 0andborder-style: noneset outside forced colors, which hid an app's own width-only border under the reset. They now leave both unset there, as their colour already was. The inline Dialog wrapper keepsmain's0/none.usePopover.forcedColorsEdge.test.tsxreads the surface's rules outside any media query; it failed on 3945797 and passes now. Popover, ContextMenu, DropdownMenu and Dialog unit tests pass (758).secondaryButton override setsborderWidth: 0, and theme component overrides have no forced-colors key, so in Gothic that button stays borderless in forced colors, as onmain. Dropping Gothic's0would also add a 1px divider between grouped secondary buttons, a visual change to a shipped theme. The Gothic gap is filed for a theme-level forced-colors capability.