Make WordPress Core

Opened 2 months ago

Closed 2 months ago

#65848 closed defect (bug) (fixed)

Toolbar: wrong text hover color for certain top-level nodes

Reported by: fushar Owned by: afercia
Priority: normal Milestone: 7.1
Component: Toolbar Version: 7.1
Severity: normal Keywords: has-patch commit dev-reviewed
Cc: Focuses: css, administration

Description

Nodes such as + New, command palette, comments, have blue hover color instead of following the admin color schemes. See attached image.

Attachments (1)

Screenshot 2026-08-11 at 15.33.13.png​ (15.6 KB ) - added by fushar 2 months ago.
blue text hover color

Download all attachments as: .zip

Change History (16)

@fushar
2 months ago

blue text hover color

#1 @fushar
2 months ago

Based on my local testing, it seems to be caused by [63009]. Can we check @afercia @joedolson?

This ticket was mentioned in ​PR #12968 on ​WordPress/wordpress-develop by ​@khokansardar.


2 months ago
#2

  • Keywords has-patch added

Top level toolbar nodes that render a label, such as + New, the command palette, Comments, and Updates, show a hardcoded blue text color on hover instead of the color from the active admin color scheme.

What the problem was:

  • [63009] removed the :not(.mobile) qualifier from the span.ab-label hover rule in the color scheme styles, but the same qualifier is still present on the default rule in src/wp-includes/css/admin-bar.css.
  • That qualifier makes the default selector more specific than the color scheme one, so the hardcoded #72aee6 wins the cascade and the color scheme is ignored for these nodes.
  • Only nodes that output a span.ab-label are affected. The surrounding hover styles, including the item background and the icons, follow the color scheme correctly, which is why the label text alone looks wrong.

What the fix does:

  • Drops :not(.mobile) from the default span.ab-label hover selector so it matches the same elements as the color scheme rule.
  • Both rules then have equal specificity and the color scheme stylesheet, which loads after admin-bar.css, wins on cascade order, exactly as it already does for the adjacent .ab-top-menu > li:hover > .ab-item rules.

Approach and why:

  • The qualifier is the outlier rather than the color scheme change. Within the same rule block, the li.hover selector has never carried :not(.mobile), so removing it makes the block internally consistent and restores parity between the two files.
  • .mobile is added from wp_is_mobile(), so it reflects the user agent, not the viewport. The color scheme side has already applied on .mobile since [63009], so this change makes the default styles consistent with it rather than introducing new mobile behavior in the admin.
  • Below the 782px breakpoint .ab-label is visually hidden, so widening the default rule has no visible effect there.

Testing instructions:

  1. Go to Users > Profile and choose an admin color scheme other than Default, for example Modern or Ectoplasm.
  1. Before the patch, hover the + New item in the toolbar. The label text turns blue (#72aee6) while the item background follows the chosen scheme.
  1. With the patch applied, hover the same item. The label text now uses the scheme color, for example #7b90ff on Modern and #fff on Ectoplasm.
  1. Repeat with the command palette, Comments, and Updates items, which also render an ab-label.
  1. Confirm the Default scheme and the front end toolbar are unchanged, since no color scheme stylesheet loads there.

## Use of AI Tools

AI assistance: Yes

Tool(s): Claude Code

Model(s): Claude Opus 5

Used for: Ticket analysis and code implementation. All changes were reviewed and validated by me.

---

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See ​GitHub Pull Requests for Code Review in the Core Handbook for more details.

#3 @madhavishah01
2 months ago

Tested the patch and confirmed that it fixes the reported issue. The toolbar text now follows the selected admin color scheme on hover as expected.

Before patch:-
​https://prnt.sc/Qg_jVoz2n1O2

After patch:-
​https://prnt.sc/tVFJJdxwdp7K

​@wildworks commented on ​PR #12968:


2 months ago
#4

Thank you for the PR. I apologize if I'm mistaken, but the PR description appears to be entirely AI-generated, which makes it quite verbose and difficult for a human to read. Please refer to ​the AI guidelines, take responsibility for AI-generated content, and revise the text to be more human-readable and easier for reviewers.

​@khokansardar commented on ​PR #12968:


2 months ago
#5

Thank you for the PR. I apologize if I'm mistaken, but the PR description appears to be entirely AI-generated, which makes it quite verbose and difficult for a human to read. Please refer to ​the AI guidelines, take responsibility for AI-generated content, and revise the text to be more human-readable and easier for reviewers.

@t-hamano I've already added the Use of AI Tools disclosure in the description.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


2 months ago

​@joedolson commented on ​PR #12968:


2 months ago
#7

@itzmekhokan The problem isn't the use of AI, which you disclosed responsibly, as expected. It's the PR description itself, which is extremely verbose. It would be much appreciated if you could edit those down to only the relevant details, rather than keeping the entirety of the AI feedback.

​@khokansardar commented on ​PR #12968:


2 months ago
#8

@itzmekhokan The problem isn't the use of AI, which you disclosed responsibly, as expected. It's the PR description itself, which is extremely verbose. It would be much appreciated if you could edit those down to only the relevant details, rather than keeping the entirety of the AI feedback.

Understood. Thanks, I've updated the PR description.

#9 @desrosj
2 months ago

In 63183:

Build/Test Tools: Skip pull_request triggered runs in private repos.

This modifies the conditions for GitHub Actions workflow runs so that they do not run within private forks and mirrors for pull_request events when the PR is in draft status.

For situations where this may be desirable, a Draft Workflow Runs label can be added to a draft pull request to force workflows to run.

Props desrosj, jorbin.
See #65848.

#10 @afercia
2 months ago

  • Keywords dev-feedback commit added
  • Owner set to afercia
  • Status new → assigned

I reviewed the linked PR andd it looks good to me.
Marking for commit and requesting dev-feedback as per double committer sign-off workflow during RC.

#11 @joedolson
2 months ago

Agree with the commit approval. Once it's committed, I'll mark as dev-reviewed for the backport.

#12 @joedolson
2 months ago

  • Resolution → fixed
  • Status assigned → closed

In 63188:

Toolbar: Inconsistent text hover color for top-level nodes.

Follow up to [63009]. Original commit removed a :not(.mobile) qualifier from the :hover rule, but not from the default state rule.

Remove the default rule as well, so colors are handled consistently.

Props fushar, khokansardar, madhavishah01, wildworks, afercia, joedolson.
Fixes #65848.

#13 @joedolson
2 months ago

  • Resolution fixed
  • Status closed → reopened

Re-opening for backport to 7.1/

#14 @wildworks
2 months ago

  • Keywords dev-reviewed added; dev-feedback removed

This is the second committer review. I approve backporting [63188] to 7.1.

#15 @wildworks
2 months ago

  • Resolution → fixed
  • Status reopened → closed

In 63202:

Toolbar: Inconsistent text hover color for top-level nodes.

Follow up to [63009]. Original commit removed a :not(.mobile) qualifier from the :hover rule, but not from the default state rule.

Remove the default rule as well, so colors are handled consistently.

Reviewed by wildworks.
Merges [63188] to the 7.1 branch.

Props fushar, khokansardar, madhavishah01, wildworks, afercia, joedolson.
Fixes #65848.

Note: See TracTickets for help on using tickets.