Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

#64811 closed defect (bug) (fixed)

Zero comment notification in admin toolbar has insufficient color contrast

Reported by: louischan's profile louischan Owned by: joedolson's profile joedolson
Milestone: 7.0 Priority: normal
Severity: normal Version: 3.8
Component: Toolbar Keywords: has-patch commit
Focuses: ui, accessibility, css, administration Cc:

Description

Hi,
When no comment is to be validated in the WordPress dashboard, the figure "0" appears next to the comment icon.

This number has an opacity of .5 applied because of the class .count-0.

The result is an insufficient color contrast to reach WCAG AA standard.

This was tested with the Modern WordPress User theme (but insufficient contrast was also noticed with other themes, like Fresh, Light, and so on).

Different solutions:

  • remove the .count-0 class, so that the color isn't altered when no comments have to be reviewed.
  • increase the opacity to .7 which is enough to get a color contrast of over 4.5, while still keeping a slight visual difference.

Attachments (3)

count-zero-calss.png (6.0 KB) - added by louischan 5 weeks ago.
Inspect tool : focus on the .count-0 class
color-contrast-zero-comment-default.png (12.8 KB) - added by louischan 5 weeks ago.
Result of the WCAG Color contrast checker for the "0" comment text in the toolbar
color-contrast-with-opacity-increased.png (12.9 KB) - added by louischan 5 weeks ago.
New color contrast with opacity set to .7

Download all attachments as: .zip

Change History (10)

@louischan
5 weeks ago

Inspect tool : focus on the .count-0 class

@louischan
5 weeks ago

Result of the WCAG Color contrast checker for the "0" comment text in the toolbar

@louischan
5 weeks ago

New color contrast with opacity set to .7

#1 @joedolson
5 weeks ago

  • Owner set to joedolson
  • Status changed from new to accepted

#2 @joedolson
5 weeks ago

  • Milestone changed from Awaiting Review to 7.0
  • Type changed from enhancement to defect (bug)

This ticket was mentioned in PR #11186 on WordPress/wordpress-develop by @hbhalodia.


5 weeks ago
#3

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/64811

  • Remove the whole CSS as no need to add opacity.
  • Fix the color contrast issue.

https://github.com/user-attachments/assets/ed7efe33-95a3-480c-b854-1c6a81c54816

## Use of AI Tools

#4 @sabernhardt
5 weeks ago

  • Keywords commit added

The WCAG Color contrast checker Chrome extension's foreground color calculations seem inaccurate for this element; Firefox tells me the ratios are 5.12:1 in Modern and 4.54:1 in Fresh.

However, in the :focus and :hover states, half-opacity is almost guaranteed to have insufficient contrast. The styles theoretically could change opacity on those states, but I like the simplicity of PR 11186.

The count-0 class remains on the element, so anyone who chooses can still change the opacity or hide the zero (or use :not(.count-0) to call attention to non-zero numbers).

#5 @sabernhardt
5 weeks ago

  • Version changed from 6.9.1 to 3.8

[26072] introduced the opacity rule.

#6 @joedolson
5 weeks ago

I 100% agree with @sabernhardt's logic for using the current PR. I don't see any meaningful advantage to having this state be different, so just removing the differentiator that causes the accessibility problem makes the most sense.

#7 @joedolson
5 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 61861:

Toolbar: A11y: Fix color contrast for zero comments.

Remove the 50% opacity change for when the adminbar comment indicators has zero comments.

Props louischan, hbhalodia, sabernhardt, joedolson.
Fixes #64811.

Note: See TracTickets for help on using tickets.