#65153 closed defect (bug) (fixed)
Identify selected buttons (.active in button groups) in Windows High Contrast Mode
| Reported by: | sabernhardt | Owned by: | joedolson |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: | accessibility, css |
Description (last modified by )
Attachments (2)
Change History (22)
This ticket was mentioned in PR #11680 on WordPress/wordpress-develop by @sabernhardt.
4 months ago
#1
- Keywords has-patch added
@
4 months ago
Before patch: alignment options in the Image details dialog do not show that 'None' is selected
@wildworks commented on PR #11680:
4 months ago
#3
@sabernhardt commented on PR #11680:
4 months ago
#4
What are your thoughts on applying a 3px border to all four sides, rather than just the bottom?
That could be better. I also considered a border only on the bottom.
The hover state is the same as the default state:
@wildworks commented on PR #11680:
4 months ago
#5
#6
@
4 months ago
Agreed with @wildworks — the third approach feels the most natural. Tested it in Windows High Contrast Mode and the active button state is clearly distinguishable without conflicting with the focus outline. The teal border works well for indicating the selected state.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
3 months ago
#8
@
3 months ago
- Milestone Awaiting Review → 7.1
- Owner set to
- Status new → accepted
I have some preference for using the first approach, since it would meet WCAG 2.4.13, but it's not required, so I'm willing to bend on that.
#11
@
3 months ago
- Keywords dev-feedback added
- Resolution fixed
- Status closed → reopened
Reopening for backport to 7.0 branch.
#12
@
3 months ago
- Keywords commit dev-feedback removed
The approach using pseudo-elements might not have been the best, as the pseudo-elements get overridden when the button with the dashicon changes to an active state.
<button class="button-primary button dashicons dashicons-admin-generic active">Button</button>
/* Only visible in Windows High Contrast mode */
.wp-core-ui .button.active:before {
content: "";
}
/* This CSS will be overridden. */
.dashicons-admin-generic:before {
content: "\f111";
}
For example, activate the "Publoish setting" button in Customizer. The dashicon will disappear.
By the way, the issue reported here should have been occurring previously, so I don't think it needs to be backported to 7.0.1.
#13
follow-up:
↓ 14
@
3 months ago
- Keywords has-patch removed
Switching the new pseudo-element from :before to :after could be a quick fix, at least for the Customizer Publish Settings button.
Or might you prefer another way to style the buttons, perhaps with the (forced-colors: active) media query?
#14
in reply to: ↑ 13
;
follow-up:
↓ 15
@
3 months ago
Replying to sabernhardt:
Switching the new pseudo-element from
:beforeto:aftercould be a quick fix, at least for the Customizer Publish Settings button.
At its core, it should be safe as there shouldn't be any cases where the .active class and the ::after pseudo-element are used simultaneously. However, third-party developers might have implemented such a combination on their own.
.wp-core-ui .button.active.my-plugin::after {
content: "Content";
}
Or might you prefer another way to style the buttons, perhaps with the
(forced-colors: active)media query?
I'm concerned that the forced-colors media query is not being used at all in the core. Is there any particular reason for this?
#15
in reply to: ↑ 14
@
3 months ago
::afterpseudo-element
Lowering the specificity to :where(.wp-core-ui .button.active)::after could decrease the chance of collision with plugins, but that still has the potential to break plugins' CSS.
I'm concerned that the
forced-colorsmedia query is not being used at all in the core. Is there any particular reason for this?
Limiting the scope to only high contrast mode seemed necessary. I did not like editing either the border or the outline of the button itself.
- Changing an
.activebutton's border width affects its overall dimensions. - Using
outlinefor the selected state can lead to confusion with the focus outline.
I'll add another PR to consider a transparent outline with a negative offset, where the outline width increases on focus. It is not particularly intuitive, but it should be an improvement compared to previous releases.
This ticket was mentioned in PR #12242 on WordPress/wordpress-develop by @sabernhardt.
3 months ago
#16
- Keywords has-patch added
- Reverts r62467 to remove pseudo-element.
- Adds a transparent outline to the
.activebuttons, with a negative outline offset. - Increases the width of the outline for the focus state.
Use of AI Tools: none
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
2 months ago
@sabernhardt commented on PR #12242:
2 months ago
#20
Committed in r62567
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)

Adds a transparent pseudo-element on active buttons. In Windows High Contrast mode, this shows a thin border on three sides and a thicker border on the bottom.
Using a pseudo-element reduces the chance of confusion with the focus outline, and it does not change the border (and button height) for other users.
Trac 65153
## Screenshots
Screenshots using:
### Permalinks options, showing focus outline on selected post name button
Before

With patch (this also shows hover style on

post_idbutton)### Alignment options
The 'None' button is selected.
#### Selected None button has focus outline
Before

With patch

#### Unselected Left button has focus outline
Before

With patch

## Use of AI Tools
none