From 1478719f61684711fd1fa3562ce1bef19e929673 Mon Sep 17 00:00:00 2001 From: James Koster Date: Mon, 23 Nov 2026 17:42:51 +0000 Subject: [PATCH] Try: Hide the Popover and Menu stroke and strengthen light elevation Make the Popover, Menu and item popup (Select, Combobox, Autocomplete) borders transparent in @wordpress/ui, and drop the stroke ring from the @wordpress/components Popover and Menu, so the elevation shadow alone separates them from the page. Forced-colors mode keeps a visible border or outline. Raise the minimum elevation shadow opacity from 0.05 to 0.08 to make up for the missing stroke on light backgrounds. Co-Authored-By: Claude Opus 5.5 --- .../internal/_wpds-token-fallbacks.scss | 8 ++-- packages/components/CHANGELOG.md | 1 + .../components/src/menu/style.module.scss | 4 +- packages/components/src/popover/style.scss | 11 +++--- packages/theme/CHANGELOG.md | 2 +- packages/theme/README.md | 2 +- packages/theme/prebuilt/css/design-tokens.css | 8 ++-- .../prebuilt/js/design-token-fallbacks.mjs | 8 ++-- packages/theme/prebuilt/js/design-tokens.mjs | 32 ++++++++-------- packages/theme/src/elevation.ts | 2 +- .../theme/src/stories/elevation.story.tsx | 21 ++++------- packages/theme/src/test/elevation.test.ts | 6 +-- packages/theme/tokens/elevation.json | 16 ++++---- packages/ui/CHANGELOG.md | 1 + packages/ui/src/menu/style.module.scss | 12 +++++- packages/ui/src/popover/style.module.scss | 37 +++++++------------ .../ui/src/utils/css/item-popup.module.scss | 12 +++++- 17 files changed, 97 insertions(+), 86 deletions(-) diff --git a/packages/base-styles/internal/_wpds-token-fallbacks.scss b/packages/base-styles/internal/_wpds-token-fallbacks.scss index e4863a5cbf8b58..85c3a5c6e16450 100644 --- a/packages/base-styles/internal/_wpds-token-fallbacks.scss +++ b/packages/base-styles/internal/_wpds-token-fallbacks.scss @@ -173,13 +173,13 @@ $fallbacks: ( "--wpds-dimension-surface-width-xl": "720px", "--wpds-dimension-surface-width-xs": "240px", "--wpds-elevation-lg": - "0px 4px 10px #0000000e, 0px 20px 48px #0000000e, inset 0px 1px #fff0", + "0px 4px 10px #00000015, 0px 20px 48px #00000015, inset 0px 1px #fff0", "--wpds-elevation-md": - "0px 2px 4px #0000000e, 0px 8px 20px #0000000e, inset 0px 1px #fff0", + "0px 2px 4px #00000015, 0px 8px 20px #00000015, inset 0px 1px #fff0", "--wpds-elevation-sm": - "0px 1px 2px #0000000e, 0px 3px 8px #0000000e, inset 0px 1px #fff0", + "0px 1px 2px #00000015, 0px 3px 8px #00000015, inset 0px 1px #fff0", "--wpds-elevation-xs": - "0px 1px 1px #0000000e, 0px 1px 3px #0000000e, inset 0px 1px #fff0", + "0px 1px 1px #00000015, 0px 1px 3px #00000015, inset 0px 1px #fff0", "--wpds-motion-duration-lg": "300ms", "--wpds-motion-duration-md": "200ms", "--wpds-motion-duration-sm": "100ms", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index b49c5b5ef48c9d..b80a0c7c8c6531 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -6,6 +6,7 @@ - `ToolsPanel`: Use WPDS colors for the reset label and the disabled "Reset all" menu item. Legacy `--wp-components-color-accent-darker-10` overrides no longer affect them ([#86797](https://github.com/WordPress/gutenberg/pull/86797)). - `CustomSelectControl`, `FormToggle`, `Menu`, `Modal`, `Popover`, `ResizableBox`, `Snackbar`, and `Tooltip`: Use the `--wpds-elevation-*` tokens for their shadows, which get stronger on darker `ThemeProvider` backgrounds ([#87287](https://github.com/WordPress/gutenberg/pull/87287)). +- `Menu` and `Popover`: Remove the visible stroke, so the elevation shadow alone separates them from the page. `Popover` keeps its stroke in the alternate style and an outline in forced-colors mode. - `Badge`: Use the `--wpds-typography-line-height-sm` token for its line height ([#87154](https://github.com/WordPress/gutenberg/pull/87154)). - `TimePicker`: Use the WordPress UI select for choosing a month ([#87079](https://github.com/WordPress/gutenberg/pull/87079)). - `QueryControls`: Use the WordPress UI select for the Order by field and show a placeholder when the current sort is missing or unavailable ([#87078](https://github.com/WordPress/gutenberg/pull/87078)). diff --git a/packages/components/src/menu/style.module.scss b/packages/components/src/menu/style.module.scss index 1ea2f1e7e31fef..194a10e213d5de 100644 --- a/packages/components/src/menu/style.module.scss +++ b/packages/components/src/menu/style.module.scss @@ -29,7 +29,9 @@ background-color: $components-color-background; border-radius: $radius-medium; - box-shadow: 0 0 0 $border-width $components-color-gray-300, var(--wpds-elevation-md); + // No stroke: the elevation shadow alone separates the menu from what's + // beneath it. Forced colors gets the `.menu` outline instead. + box-shadow: var(--wpds-elevation-md); &:where(.is-toolbar) { box-shadow: 0 0 0 $border-width $components-color-foreground; diff --git a/packages/components/src/popover/style.scss b/packages/components/src/popover/style.scss index fcc02a9c6bcd1e..41cc467b6ac124 100644 --- a/packages/components/src/popover/style.scss +++ b/packages/components/src/popover/style.scss @@ -5,7 +5,6 @@ $arrow-triangle-base-size: 14px; -$shadow-popover-border-default: 0 0 0 var(--wpds-border-width-xs) var(--wpds-color-stroke-surface-neutral); $shadow-popover-border-default-alternate: 0 0 0 $border-width $gray-900; $shadow-popover-border-top-only: 0 calc(var(--wpds-border-width-xs) * -1) 0 0 var(--wpds-color-stroke-surface-neutral); $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900; @@ -26,8 +25,9 @@ $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900; .components-popover__content { background: var(--wpds-color-background-surface-neutral-strong); - // The stroke stays on the box-shadow, since consumers override it there. - box-shadow: $shadow-popover-border-default, var(--wpds-elevation-md); + // No stroke: the elevation shadow alone separates the popover from what's + // beneath it. Forced colors still gets an outline (see below). + box-shadow: var(--wpds-elevation-md); border-radius: var(--wpds-border-radius-md); box-sizing: border-box; width: min-content; @@ -143,10 +143,11 @@ $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900; } .components-popover__triangle-border { - // Stroke colors are the same as the .components-popover__content's outline + // The default popover has no stroke, so neither does its arrow. The + // alternate and forced-colors treatments below still draw one. fill: transparent; stroke-width: var(--wpds-border-width-xs); - stroke: var(--wpds-color-stroke-surface-neutral); + stroke: transparent; .is-alternate & { stroke: $gray-900; diff --git a/packages/theme/CHANGELOG.md b/packages/theme/CHANGELOG.md index de1e6ba29254f4..c9a8f892d11161 100644 --- a/packages/theme/CHANGELOG.md +++ b/packages/theme/CHANGELOG.md @@ -4,7 +4,7 @@ ### New Features -- Add `--wpds-elevation-xs`, `--wpds-elevation-sm`, `--wpds-elevation-md`, and `--wpds-elevation-lg` shadow tokens. Each level is two black shadows and a 1px inset white highlight along the top edge. `ThemeProvider` strengthens both as the background seed gets darker: the shadows from 5% opacity on white to 30% on black, and the highlight from 0% to 10% ([#87287](https://github.com/WordPress/gutenberg/pull/87287)). +- Add `--wpds-elevation-xs`, `--wpds-elevation-sm`, `--wpds-elevation-md`, and `--wpds-elevation-lg` shadow tokens. Each level is two black shadows and a 1px inset white highlight along the top edge. `ThemeProvider` strengthens both as the background seed gets darker: the shadows from 8% opacity on white to 30% on black, and the highlight from 0% to 10% ([#87287](https://github.com/WordPress/gutenberg/pull/87287)). ### Internal diff --git a/packages/theme/README.md b/packages/theme/README.md index 3946866f176d4b..4d98118ebc50e1 100644 --- a/packages/theme/README.md +++ b/packages/theme/README.md @@ -229,7 +229,7 @@ The `cornerRadius` prop sets the overall roundness preset for the theme subtree. `ThemeProvider` has no light or dark mode. It accepts color seeds and turns them into semantic design tokens. Consumers define light and dark themes by choosing those seeds: a light background seed makes the generated color ramp favor darker contrasting colors, while a dark background seed makes it favor lighter contrasting colors. The primary seed controls the accent color rather than the overall light or dark appearance. -The background seed also sets the strength of the `--wpds-elevation-*` shadows. Black shadows show less against a dark background, so their opacity increases as the background gets darker, from 5% on white to 30% on black. Each level also has a 1px white highlight inset along its top edge, which follows the same curve: invisible on white, up to 10% on black. +The background seed also sets the strength of the `--wpds-elevation-*` shadows. Black shadows show less against a dark background, so their opacity increases as the background gets darker, from 8% on white to 30% on black. Each level also has a 1px white highlight inset along its top edge, which follows the same curve: invisible on white, up to 10% on black. ### Nesting Providers diff --git a/packages/theme/prebuilt/css/design-tokens.css b/packages/theme/prebuilt/css/design-tokens.css index 47e70dcc3434c2..2f9dd30da2d5bd 100644 --- a/packages/theme/prebuilt/css/design-tokens.css +++ b/packages/theme/prebuilt/css/design-tokens.css @@ -313,16 +313,16 @@ --wpds-dimension-surface-width-xs: 240px; /* Elevation for surfaces that sit above the whole page, such as dialogs and drawers. */ --wpds-elevation-lg: - 0px 4px 10px #0000000e, 0px 20px 48px #0000000e, inset 0px 1px #fff0; + 0px 4px 10px #00000015, 0px 20px 48px #00000015, inset 0px 1px #fff0; /* Elevation for floating surfaces anchored to a trigger, such as popovers and menus. */ --wpds-elevation-md: - 0px 2px 4px #0000000e, 0px 8px 20px #0000000e, inset 0px 1px #fff0; + 0px 2px 4px #00000015, 0px 8px 20px #00000015, inset 0px 1px #fff0; /* Elevation for small transient surfaces close to their trigger, such as tooltips. */ --wpds-elevation-sm: - 0px 1px 2px #0000000e, 0px 3px 8px #0000000e, inset 0px 1px #fff0; + 0px 1px 2px #00000015, 0px 3px 8px #00000015, inset 0px 1px #fff0; /* Elevation for small controls raised slightly above their surface, such as a switch thumb. */ --wpds-elevation-xs: - 0px 1px 1px #0000000e, 0px 1px 3px #0000000e, inset 0px 1px #fff0; + 0px 1px 1px #00000015, 0px 1px 3px #00000015, inset 0px 1px #fff0; /* Deliberate animations like slides and reveals */ --wpds-motion-duration-lg: 300ms; /* Standard transitions like menus and popovers */ diff --git a/packages/theme/prebuilt/js/design-token-fallbacks.mjs b/packages/theme/prebuilt/js/design-token-fallbacks.mjs index 2602e1921cbc01..7c3cb6316583a9 100644 --- a/packages/theme/prebuilt/js/design-token-fallbacks.mjs +++ b/packages/theme/prebuilt/js/design-token-fallbacks.mjs @@ -171,13 +171,13 @@ export default { '--wpds-dimension-surface-width-xl': '720px', '--wpds-dimension-surface-width-xs': '240px', '--wpds-elevation-lg': - '0px 4px 10px #0000000e, 0px 20px 48px #0000000e, inset 0px 1px #fff0', + '0px 4px 10px #00000015, 0px 20px 48px #00000015, inset 0px 1px #fff0', '--wpds-elevation-md': - '0px 2px 4px #0000000e, 0px 8px 20px #0000000e, inset 0px 1px #fff0', + '0px 2px 4px #00000015, 0px 8px 20px #00000015, inset 0px 1px #fff0', '--wpds-elevation-sm': - '0px 1px 2px #0000000e, 0px 3px 8px #0000000e, inset 0px 1px #fff0', + '0px 1px 2px #00000015, 0px 3px 8px #00000015, inset 0px 1px #fff0', '--wpds-elevation-xs': - '0px 1px 1px #0000000e, 0px 1px 3px #0000000e, inset 0px 1px #fff0', + '0px 1px 1px #00000015, 0px 1px 3px #00000015, inset 0px 1px #fff0', '--wpds-motion-duration-lg': '300ms', '--wpds-motion-duration-md': '200ms', '--wpds-motion-duration-sm': '100ms', diff --git a/packages/theme/prebuilt/js/design-tokens.mjs b/packages/theme/prebuilt/js/design-tokens.mjs index 0182e734f02809..bb44082af630e0 100644 --- a/packages/theme/prebuilt/js/design-tokens.mjs +++ b/packages/theme/prebuilt/js/design-tokens.mjs @@ -2660,7 +2660,7 @@ export const tokens = /** @type {const} */ ( { $type: 'shadow', group: 'elevation', fallback: - '0px 1px 1px #0000000e, 0px 1px 3px #0000000e, inset 0px 1px #fff0', + '0px 1px 1px #00000015, 0px 1px 3px #00000015, inset 0px 1px #fff0', modes: { default: { $value: [ @@ -2668,7 +2668,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2692,7 +2692,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2737,7 +2737,7 @@ export const tokens = /** @type {const} */ ( { inset: true, }, ], - css: '0px 1px 1px #0000000e, 0px 1px 3px #0000000e, inset 0px 1px #fff0', + css: '0px 1px 1px #00000015, 0px 1px 3px #00000015, inset 0px 1px #fff0', }, }, }, @@ -2747,7 +2747,7 @@ export const tokens = /** @type {const} */ ( { $type: 'shadow', group: 'elevation', fallback: - '0px 1px 2px #0000000e, 0px 3px 8px #0000000e, inset 0px 1px #fff0', + '0px 1px 2px #00000015, 0px 3px 8px #00000015, inset 0px 1px #fff0', modes: { default: { $value: [ @@ -2755,7 +2755,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2779,7 +2779,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2824,7 +2824,7 @@ export const tokens = /** @type {const} */ ( { inset: true, }, ], - css: '0px 1px 2px #0000000e, 0px 3px 8px #0000000e, inset 0px 1px #fff0', + css: '0px 1px 2px #00000015, 0px 3px 8px #00000015, inset 0px 1px #fff0', }, }, }, @@ -2834,7 +2834,7 @@ export const tokens = /** @type {const} */ ( { $type: 'shadow', group: 'elevation', fallback: - '0px 2px 4px #0000000e, 0px 8px 20px #0000000e, inset 0px 1px #fff0', + '0px 2px 4px #00000015, 0px 8px 20px #00000015, inset 0px 1px #fff0', modes: { default: { $value: [ @@ -2842,7 +2842,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2866,7 +2866,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2911,7 +2911,7 @@ export const tokens = /** @type {const} */ ( { inset: true, }, ], - css: '0px 2px 4px #0000000e, 0px 8px 20px #0000000e, inset 0px 1px #fff0', + css: '0px 2px 4px #00000015, 0px 8px 20px #00000015, inset 0px 1px #fff0', }, }, }, @@ -2921,7 +2921,7 @@ export const tokens = /** @type {const} */ ( { $type: 'shadow', group: 'elevation', fallback: - '0px 4px 10px #0000000e, 0px 20px 48px #0000000e, inset 0px 1px #fff0', + '0px 4px 10px #00000015, 0px 20px 48px #00000015, inset 0px 1px #fff0', modes: { default: { $value: [ @@ -2929,7 +2929,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2953,7 +2953,7 @@ export const tokens = /** @type {const} */ ( { color: { colorSpace: 'srgb', components: [ 0, 0, 0 ], - alpha: 0.053, + alpha: 0.083, }, offsetX: { value: 0, @@ -2998,7 +2998,7 @@ export const tokens = /** @type {const} */ ( { inset: true, }, ], - css: '0px 4px 10px #0000000e, 0px 20px 48px #0000000e, inset 0px 1px #fff0', + css: '0px 4px 10px #00000015, 0px 20px 48px #00000015, inset 0px 1px #fff0', }, }, }, diff --git a/packages/theme/src/elevation.ts b/packages/theme/src/elevation.ts index b8c4d78e00a89c..1ea46778cab2b1 100644 --- a/packages/theme/src/elevation.ts +++ b/packages/theme/src/elevation.ts @@ -4,7 +4,7 @@ import { ColorSpace, getLuminance, sRGB } from 'colorjs.io/fn'; * Shadow opacity range. The lightest background (white) gets `min`, the * darkest (black) gets `max`. */ -const ELEVATION_OPACITY = { min: 0.05, max: 0.3 }; +const ELEVATION_OPACITY = { min: 0.08, max: 0.3 }; /** * Top-edge highlight opacity range. White gets `min` (no highlight), black diff --git a/packages/theme/src/stories/elevation.story.tsx b/packages/theme/src/stories/elevation.story.tsx index 8e15dd666939e4..e266f68c8c2bde 100644 --- a/packages/theme/src/stories/elevation.story.tsx +++ b/packages/theme/src/stories/elevation.story.tsx @@ -6,13 +6,11 @@ import { getElevationOpacity, getHighlightOpacity } from '../elevation'; const LEVELS = [ { token: '--wpds-elevation-xs', usage: 'Switch thumb' }, { token: '--wpds-elevation-sm', usage: 'Tooltip' }, - { token: '--wpds-elevation-md', usage: 'Popover, menu', stroke: true }, + { token: '--wpds-elevation-md', usage: 'Popover, menu' }, { token: '--wpds-elevation-lg', usage: 'Dialog, drawer' }, ]; -type Strokes = 'as used' | 'none' | 'all'; - -type Args = { background: string; strokes: Strokes }; +type Args = { background: string; strokes: boolean }; const text: CSSProperties = { color: 'var(--wpds-color-foreground-content-neutral)', @@ -30,7 +28,7 @@ const Levels = ( { strokes, }: { title: ReactNode; - strokes: Strokes; + strokes: boolean; } ) => (
- { LEVELS.map( ( { token, usage, stroke } ) => ( + { LEVELS.map( ( { token, usage } ) => (
= { title: 'Design System/Theme/Elevation', args: { background: '#fcfcfc', - strokes: 'as used', + strokes: false, }, argTypes: { background: { control: 'color' }, strokes: { - control: 'inline-radio', - options: [ 'as used', 'none', 'all' ], + control: 'boolean', description: - 'Which cards get a stroke. "as used" matches the components: only popovers and menus have one.', + 'Add a stroke to every card. Popovers and menus have no stroke, so the shadow alone separates them from the page.', }, }, parameters: { diff --git a/packages/theme/src/test/elevation.test.ts b/packages/theme/src/test/elevation.test.ts index 334372970dda3b..5e1daed4e89ac0 100644 --- a/packages/theme/src/test/elevation.test.ts +++ b/packages/theme/src/test/elevation.test.ts @@ -41,9 +41,9 @@ describe( 'elevation', () => { } ); it( 'increases shadow opacity as the background gets darker', () => { - expect( getElevationOpacity( '#ffffff' ) ).toBe( 0.05 ); - expect( getElevationOpacity( '#777777' ) ).toBe( 0.193 ); - expect( getElevationOpacity( '#1e1e1e' ) ).toBe( 0.272 ); + expect( getElevationOpacity( '#ffffff' ) ).toBe( 0.08 ); + expect( getElevationOpacity( '#777777' ) ).toBe( 0.206 ); + expect( getElevationOpacity( '#1e1e1e' ) ).toBe( 0.275 ); expect( getElevationOpacity( '#000000' ) ).toBe( 0.3 ); } ); } ); diff --git a/packages/theme/tokens/elevation.json b/packages/theme/tokens/elevation.json index a4f4f12e8b7122..db364ba81a83d0 100644 --- a/packages/theme/tokens/elevation.json +++ b/packages/theme/tokens/elevation.json @@ -7,7 +7,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -30,7 +30,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -82,7 +82,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -105,7 +105,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -157,7 +157,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -180,7 +180,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -232,7 +232,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, @@ -255,7 +255,7 @@ "color": { "colorSpace": "srgb", "components": [ 0, 0, 0 ], - "alpha": 0.053 + "alpha": 0.083 }, "offsetX": { "value": 0, diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index 00e95ff42f6746..fe4c25d7b23df3 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -9,6 +9,7 @@ ### Enhancements - `Autocomplete`, `Combobox`, `Dialog`, `Drawer`, `Menu`, `Popover`, `Select`, `Switch`, and `Tooltip`: Use the `--wpds-elevation-*` tokens for their shadows, which get stronger on darker `ThemeProvider` backgrounds ([#87287](https://github.com/WordPress/gutenberg/pull/87287)). +- `Autocomplete`, `Combobox`, `Menu`, `Popover`, and `Select`: Remove the visible stroke from the popup, so the elevation shadow alone separates it from the page. The border still shows in forced-colors mode. - `Avatar`: Add a visual `active` state with a ring, remove inactive borders, derive a contrasting fallback fill from the ring color, fit initials to small sizes, and enlarge single initials. ([#85208](https://github.com/WordPress/gutenberg/pull/85208)) - `Menu.CheckboxItem` uses a larger, centered 20px checkmark ([#86974](https://github.com/WordPress/gutenberg/pull/86974)). - `Select`, `Combobox`, and the controls built on them: Use a larger, centered 20px checkmark for selected items ([#87021](https://github.com/WordPress/gutenberg/pull/87021)). diff --git a/packages/ui/src/menu/style.module.scss b/packages/ui/src/menu/style.module.scss index e8a9ef1f56a491..b27cd730337f4c 100644 --- a/packages/ui/src/menu/style.module.scss +++ b/packages/ui/src/menu/style.module.scss @@ -30,11 +30,21 @@ padding: var(--wp-ui-menu-popup-padding); scroll-padding: var(--wp-ui-menu-popup-padding); border-radius: var(--wpds-border-radius-md); - border: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral); + border: var(--wpds-border-width-xs) solid transparent; box-shadow: var(--wpds-elevation-md); background-color: var(--wpds-color-background-surface-neutral-strong); outline: none; + /* + * The border is transparent so the shadow alone separates the + * surface from what's beneath it. Forced-colors mode strips + * `box-shadow` and doesn't substitute `transparent`, so paint the + * border there to keep the boundary. + */ + @media ( forced-colors: active ) { + border-color: CanvasText; + } + /* The indicator already sets labels in, so tighten the start edge. */ &:has(.item-selection-indicator) { --_wp-ui-menu-item-padding-inline-start: var(--wpds-dimension-padding-xs); diff --git a/packages/ui/src/popover/style.module.scss b/packages/ui/src/popover/style.module.scss index 8be6108c17e021..a8a7e0ebf91eb6 100644 --- a/packages/ui/src/popover/style.module.scss +++ b/packages/ui/src/popover/style.module.scss @@ -37,7 +37,7 @@ background-color: var(--wpds-color-background-surface-neutral-strong); padding: var(--wpds-dimension-padding-lg); border-radius: var(--wpds-border-radius-md); - border: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral); + border: var(--wpds-border-width-xs) solid transparent; box-shadow: var(--wpds-elevation-md); font-family: var(--wpds-typography-font-family-body); font-size: var(--wpds-typography-font-size-md); @@ -46,29 +46,16 @@ } /* - * When a backdrop is rendered alongside the popup, hide the - * regular-mode border. The backdrop already provides visual - * containment, so the border becomes redundant noise. - * `transparent` (not `none`) keeps surface geometry identical - * regardless of the `backdrop` prop — `box-sizing: border-box` - * absorbs the 1px into the existing box. - */ - .backdrop ~ * .surface { - border-color: transparent; - } - - /* - * Forced-colors mode strips `box-shadow` and substitutes - * `background-color` with `Canvas` (the page background), so the - * boundary depends entirely on the border. Set `CanvasText` - * explicitly for both backdrop and non-backdrop popups: - * `transparent` is not substituted by the UA, and being - * explicit also removes any reliance on UA color-substitution - * behavior for the non-backdrop case. + * The border is transparent so the elevation shadow alone separates + * the surface from what's beneath it. `transparent` (not `none`) + * keeps the geometry the arrow is aligned to. Forced-colors mode + * strips `box-shadow` and substitutes `background-color` with + * `Canvas` (the page background), so the boundary depends entirely + * on the border there. `transparent` is not substituted by the UA, + * so set `CanvasText` explicitly. */ @media (forced-colors: active) { - .surface, - .backdrop ~ * .surface { + .surface { border-color: CanvasText; } } @@ -102,7 +89,11 @@ } .arrow-stroke { - fill: var(--wpds-color-stroke-surface-neutral); + fill: transparent; + + @media (forced-colors: active) { + fill: CanvasText; + } } .title { diff --git a/packages/ui/src/utils/css/item-popup.module.scss b/packages/ui/src/utils/css/item-popup.module.scss index e6523ed32e8dbd..ae2fcc168f4bc7 100644 --- a/packages/ui/src/utils/css/item-popup.module.scss +++ b/packages/ui/src/utils/css/item-popup.module.scss @@ -15,9 +15,19 @@ min-width: var(--anchor-width); max-width: min(var(--available-width), var(--_wp-ui-item-popup-max-width, var(--available-width))); border-radius: var(--wpds-border-radius-md); - border: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral); + border: var(--wpds-border-width-xs) solid transparent; box-shadow: var(--wpds-elevation-md); background-color: var(--wpds-color-background-surface-neutral-strong); + + /* + * The border is transparent so the shadow alone separates the + * surface from what's beneath it. Forced-colors mode strips + * `box-shadow` and doesn't substitute `transparent`, so paint the + * border there to keep the boundary. + */ + @media ( forced-colors: active ) { + border-color: CanvasText; + } } .is-width-anchor {