Repository navigation
DropdownMenu: Invert the selected item indicator while highlighted - #86330
Conversation
The dark tile behind a selected item's icon was designed for the plain menu background. Since popup items gained a solid brand highlight, it has sat at about 2.4:1 against the fill and reads as a stray dark block. Swap the highlight's own foreground and background on the tile, so that it follows the admin color scheme and keeps the contrast of the item's text.
🤖 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: +421 B (0%) Total Size: 8.61 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. Undo restores the post selection when another synced entity is loaded in
|
WordPress gives Dashicons a 100 ms color transition, so the glyph lagged behind the tile background and was briefly white on the light tile.
|
@WordPress/gutenberg-design Is this design workaround acceptable for now? 😅 |
Yeah the solution is to adopt |
t-hamano
left a comment
There was a problem hiding this comment.
Given that forced colors mode has no system color darker than Highlight, inverting the icon and background colors on hover or focus feels like the simplest and clearest approach.
P.S. In forced colors mode, especially with a dark theme, the dark tile behind the active item's icon blends into the background, so the active state is hard to see. This predates this PR, so it could be addressed in a follow-up.
Testing on Windows High Contrast Mode:
| Theme name | Screenshot |
|---|---|
| Aquatic | ![]() |
| Desert | ![]() |
| Dusk | ![]() |
| Night sky | ![]() |
|
Thanks everyone for looking into this 🙏
Right, everything around the toolbar seems like it needs a forced colors pass. |
|
There was a conflict while trying to cherry-pick the commit to the wp/7.2 branch. Please resolve the conflict manually and create a PR to the wp/7.2 branch. PRs to wp/7.2 are similar to PRs to trunk, but you should base your PR on the wp/7.2 branch instead of trunk. |
…ighted (#86379) * DropdownMenu: Invert the selected item indicator while highlighted (#86330) * DropdownMenu: Invert the selected item indicator while highlighted The dark tile behind a selected item's icon was designed for the plain menu background. Since popup items gained a solid brand highlight, it has sat at about 2.4:1 against the fill and reads as a stray dark block. Swap the highlight's own foreground and background on the tile, so that it follows the admin color scheme and keeps the contrast of the item's text. * Add changelog link * DropdownMenu: Switch selected Dashicon colors without a fade WordPress gives Dashicons a 100 ms color transition, so the glyph lagged behind the tile background and was briefly white on the light tile. Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> (cherry picked from commit bdc530c) * Add changelog link --------- Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
…ordPress#86330) * DropdownMenu: Invert the selected item indicator while highlighted The dark tile behind a selected item's icon was designed for the plain menu background. Since popup items gained a solid brand highlight, it has sat at about 2.4:1 against the fill and reads as a stray dark block. Swap the highlight's own foreground and background on the tile, so that it follows the admin color scheme and keeps the contrast of the item's text. * Add changelog link * DropdownMenu: Switch selected Dashicon colors without a fade WordPress gives Dashicons a 100 ms color transition, so the glyph lagged behind the tile background and was briefly white on the light tile. Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org>





What?
Inverts the selected item's icon tile in
DropdownMenuwhile that item is highlighted by hover or keyboard focus. The tile becomes light with a brand-colored glyph, and it returns to the dark tile when the highlight moves away.Why?
The dark tile was designed for a plain menu background. Since popup items gained a solid brand highlight in #84583, it has about 2.4:1 contrast against the fill and reads as a stray dark block on the row. The inverted tile has about 6:1 contrast against the same fill.
How?
The tile swaps the highlight's own foreground and background tokens instead of picking a fixed color, so it follows the admin color scheme and always has the same contrast as the item's text. The alternatives were a transparent tile with an outline, which reads as a second focus ring, a translucent white tile, which looks muddy and depends on the accent color, and no tile at all, which hides the checked state on the focused item.
Testing Instructions
Align blockmenu in the block toolbar.Align textmenu, reopen the menu, and hover the selected item. It should show the same light tile.Testing Instructions for Keyboard
Alt+F10to move focus to the block toolbar.Align block, then pressArrowDownto open the menu. The first item is focused.Noneselected, confirm that it shows the light tile. PressArrowDownand confirm that it returns to the dark tile.Screenshots or screencast
The selected item is highlighted in each image.