Skip to content

ToolsPanel: Keep the "Reset" label visible on the highlighted menu item - #86045

Merged
mirka merged 4 commits into
WordPress:trunkfrom
karthikeya-io:fix/tools-panel-reset-label-highlight
Oct 30, 2026
Merged

mirka merged 4 commits into
WordPress:trunkfrom
karthikeya-io:fix/tools-panel-reset-label-highlight

Conversation

@karthikeya-io

@karthikeya-io karthikeya-io commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What?

Follow-up to #84583.

Keeps the "Reset" label readable when its ToolsPanel menu item is hovered or focused.

Why?

Since #84583, the active popup item uses a solid brand fill with a matching foreground color. The "Reset" label in the ToolsPanel options menu (for example Dimensions ⋮ → Padding) keeps its own accent color, so on the highlighted item it is blue text on a blue fill and nearly invisible.

How?

The label inherits the item's foreground color while the item is highlighted, matching how #84583 handles CustomSelectControl hints (.item-hint) and MenuItem info text. Disabled items are excluded, as in the shared highlight styles. The label keeps its accent color when the item is not highlighted.

Testing Instructions

Testing Instructions for Keyboard

  1. Open a post and insert a Group block.
  2. In the block settings, set a padding value.
  3. Open the Dimensions panel's options menu (⋮).
  4. Hover the Padding item. The "Reset" label is white on the blue fill.
  5. Use the arrow keys to move through the menu. The label is white on the highlighted item and blue on the others.
  6. Items without "Reset" still show a focus ring instead of the fill, as before

Screenshots or screencast

Before After
image image

Use of AI Tools

Claude Code (Claude Opus 5.5) helped trace the regression to #84583 and write the fix and this description.

@github-actions github-actions Bot added the [Package] Components /packages/components label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

@karthikeya-io
karthikeya-io force-pushed the fix/tools-panel-reset-label-highlight branch from 2cf3bf9 to 15ba2af Compare October 30, 2026 11:48
@karthikeya-io
karthikeya-io marked this pull request as ready for review October 30, 2026 11:55
@karthikeya-io
karthikeya-io requested a review from a team as a code owner October 30, 2026 11:55
Comment on lines +102 to +105
// Match the foreground of the highlighted item's brand fill.
&:is(:focus, [aria-selected="true"]):not(:disabled, [aria-disabled="true"]) .reset-label {
color: inherit;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Reset label only renders on the role="menuitem" items, which never get aria-selected and are never disabled, so only :focus can match here. Can we simplify this?

Suggested change
// Match the foreground of the highlighted item's brand fill.
&:is(:focus, [aria-selected="true"]):not(:disabled, [aria-disabled="true"]) .reset-label {
color: inherit;
}
// Match the foreground of the highlighted item's brand fill.
&:focus .reset-label {
color: inherit;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I've applied the suggestion.

@karthikeya-io
karthikeya-io force-pushed the fix/tools-panel-reset-label-highlight branch from bb5dd99 to 0c70460 Compare October 30, 2026 12:17
@karthikeya-io
karthikeya-io requested a review from mirka October 30, 2026 12:33
@mirka mirka added [Type] Bug An existing feature does not function as intended Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Oct 30, 2026
@mirka
mirka merged commit 2b193fb into WordPress:trunk Oct 30, 2026
103 of 104 checks passed
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 30, 2026
@github-actions

Copy link
Copy Markdown

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.

# Checkout the wp/7.2 branch instead of trunk.
git checkout wp/7.2

# Create a new branch for your PR.
git checkout -b my-branch

# Cherry-pick the commit.
git cherry-pick 2b193fbe7f9125c6d4e9499be4845c42d696dfee

# Check which files have conflicts.
git status

# Resolve the conflict...
# Add the resolved files to the staging area.
git status
git add .
git cherry-pick --continue

# Push the branch to the repository
git push origin my-branch

# Create a PR and set the base to the wp/7.2 branch.
# See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request.

mirka added a commit that referenced this pull request Oct 30, 2026
…d menu item (#86060)

* ToolsPanel: Keep the "Reset" label visible on the highlighted menu item (#86045)

* ToolsPanel: Keep the "Reset" label visible on the highlighted menu item

* Chore: Update changelog with PR

* Refactor:  Nest the highlighted reset label rule under the default controls item

* Fix: Simplify the highlighted reset label selector

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
(cherry picked from commit 2b193fb)

* Changelog: Link the WP 7.2 ToolsPanel backport

---------

Co-authored-by: Karthikeya Bethu <82776409+karthikeya-io@users.noreply.github.com>
Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
@mirka mirka added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants