Repository navigation
Tooltip: Invert the theme's neutral tokens instead of nesting a dark ThemeProvider - #87817
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: -6.22 kB (-0.07%) Total Size: 8.73 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Submenu interactions on Safari (@WebKit) in
|
Drop the ThemeProvider that Tooltip.Popup rendered with a fixed #1e1e1e background. Swap the neutral content tokens instead, so the tooltip contrasts with the surrounding theme, and remove the --_wp-ui-tooltip-shadow workaround on the positioner. Apply the same tokens to the @wordpress/components Tooltip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erences Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lity fixture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bundle Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dependency No component mounts ThemeProvider since the Tooltip change, so the fallback and its lock-unlock module have no runtime consumer. Tests import ThemeProvider from @wordpress/theme directly. Keep @wordpress/ui in the private APIs allowlist, because published versions still opt in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te APIs dependency" This reverts commit 06bddba.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bfb887a to
4e57a07
Compare
The tests covered the swapped neutral tokens from #87817. The tooltip now uses the surface tokens like any other overlay, so they no longer test anything specific to it.
The tests covered the swapped neutral tokens from #87817. The tooltip now uses the surface tokens like any other overlay, so they no longer test anything specific to it.
* Tooltip, Snackbar: Follow the theme instead of staying dark Implement option C from #87834. Tooltip (both packages), Snackbar, the block drag chip, and the canvas stop hint now use the neutral surface, text, and stroke tokens of the theme around them, like popovers, instead of fixed dark colors or swapped tokens. Remove the patches that kept the snackbar action text and upload spinner white. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add changelog entries Rewrite the unreleased Tooltip entries for the final behavior, and remove the unreleased Snackbar and upload spinner fixes that no longer apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Block Editor: Keep the drag chip height with its new border Include the border in the chip's height so the chip stays centered on the pointer, and drop a radius the invalid overlay could not inherit. * Site Editor: Use the content colors for every snackbar Snackbars over the mobile sidebar took the admin color scheme, so they turned dark or tinted while tooltips and menus over the same sidebar stay light. Seed them with the content colors everywhere, like the extensible site editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * RangeControl, ResizableBox: Follow the theme in the value and size tooltips The RangeControl value tooltip and the ResizableBox size tooltip were the last dark tooltips. Give them the theme's surface, text, stroke, and shadow, like Tooltip. Also keep the drag chip's "cannot drop here" symbol in forced-colors mode, which stripped the box-shadow and gradient that draw it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * RangeControl, ResizableBox: Use WPDS tokens for the tooltip colors Reference the design system tokens directly, like Tooltip and Popover, instead of the legacy `--wp-components-color-*` variables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * UI: Drop the forced-colors border override from Tooltip Forced-colors mode already draws the stroke in a system color, as it does for Popover. * UI: Drop the Tooltip theme tests The tests covered the swapped neutral tokens from #87817. The tooltip now uses the surface tokens like any other overlay, so they no longer test anything specific to it. --------- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org>
What?
Follow-up to #87287 (follow-up 1a).
Tooltip.Popupin@wordpress/uino longer wraps its content in aThemeProviderwith a fixed#1e1e1ebackground. It swaps two neutral tokens instead:--wpds-color-foreground-content-neutralfor the background and--wpds-color-background-surface-neutralfor the text. The@wordpress/componentsTooltipuses the same two tokens in place of its hard-coded$gray-900and$gray-100.Why?
The nested provider was added in #74625, because no token existed for an always-dark surface. It makes the tooltip ignore the page theme. It also forced #87287 to resolve the shadow on the positioner (
--_wp-ui-tooltip-shadow), so that the tooltip shadow follows the page and not the tooltip's own dark seed. Without the nested provider, the popup reads the page's tokens directly, and the workaround goes away.This is the best short-term compromise we found to remove the
ThemeProviderhack. It does not commit to new WPDS tokens, and it keeps most of the current appearance. The main visible change is in dark themes, where tooltips now turn light. Dark themes are not widely used in WordPress today. The long-term design of tooltips and snackbars in dark themes is tracked in #87834.How?
*-interactive-neutral-strong) are meant for controls.#252525to#1e1e1e, and the text from#f0f0f0to#fcfcfc, the default neutral surface.#f0f0f0with#1e1e1etext on the dark Storybook theme.--wpds-shadow-outer-smfrom the page's provider, so the positioner no longer needs--_wp-ui-tooltip-shadow.Tooltip.Popupthat uses--wpds-color-*tokens used to get the values of the nested dark theme. It now gets the page theme's values. No popup content in the repository uses these tokens.@wordpress/uibundle no longer mountsThemeProvider, sotools/validation/fixtures/theme-compatibility/README.mdnow scopes the fallback checks to the published bundle.@wordpress/componentschangelog entry for Components: Use WPDS stroke tokens on raised surfaces #87840 moves from the 45.1.0 section to Unreleased.Why not use the always-dark ("perma-dark") ramp colors?
The background ramp generates an always-dark fill,
bgFillDark, and its text color,fgFillDark. Using them would keep tooltips dark in dark themes. But primitive ramp colors are not emitted as CSS custom properties. Only semantic tokens are. No semantic token aliasesbgFillDark, andfgFillDarkis reachable only through--wpds-color-background-thumb-neutral(the switch knob). Using the perma-dark colors would need a new token, which is what this PR avoids.Also,
bgFillDarkis#1e1e1eon light seeds but#000on dark seeds, so even that token would change how tooltips look in dark themes.Follow-ups
ThemeProvidercompatibility fallback, itslock-unlock.tsmodule and the@wordpress/private-apisdependency of@wordpress/ui, which have no runtime consumer after this PR.Testing Instructions
npm run storybook:dev.Testing Instructions for Keyboard
No interaction changes. Focus a tooltip trigger with Tab. The tooltip should open with the colors described above.
Screenshots
Storybook
design-system-components-tooltip--default, dark color theme:Light theme, and the @wordpress/components Tooltip
@wordpress/uiTooltip, light color theme:@wordpress/componentsTooltip (components-tooltip--default), light color theme:@wordpress/componentsTooltip, dark color theme:Use of AI Tools
Written with Claude Code (Claude Opus 5.5), at my direction: Claude implemented the change and the tests, captured the screenshots, and drafted this description.
🤖 Generated with Claude Code