Make WordPress Core

Opened 7 weeks ago

Last modified 6 days ago

#65153 reopened defect (bug)

Identify selected buttons (.active in button groups) in Windows High Contrast Mode

Reported by: sabernhardt's profile sabernhardt Owned by: joedolson's profile joedolson
Milestone: 7.1 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: accessibility, css Cc:

Description (last modified by sabernhardt)

Buttons within groups do not distinguish which buttons are selected in Windows High Contrast Mode.

This includes:

  • custom options in Permalink Settings
  • alignment options in the Image details dialog (when replacing an image within a post in classic editor)

Before patch: alignment options in the Image details dialog do not show that 'None' is selected

Attachments (2)

Align-None-selected-without-focus.png (30.6 KB) - added by sabernhardt 7 weeks ago.
Before patch: alignment options in the Image details dialog do not show that 'None' is selected
customizer-button-active.png (166.2 KB) - added by wildworks 6 days ago.
Customizer: Style for an active Publish Settings button

Download all attachments as: .zip

Change History (14)

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


7 weeks ago
#1

  • Keywords has-patch added

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:

  • Windows 11
  • Aquatic contrast theme plus Dark mode
  • Chrome 147.0.7727.102

### Permalinks options, showing focus outline on selected post name button

Before
https://github.com/user-attachments/assets/0768bce1-1d71-4bc9-b322-4f561ddc5e9f

With patch (this also shows hover style on post_id button)
https://github.com/user-attachments/assets/7bc8783d-92b3-4a62-91a1-c8dbdcaf19a2

### Alignment options

The 'None' button is selected.

#### Selected None button has focus outline

Before
https://github.com/user-attachments/assets/c95ee48e-e290-4863-8ca9-2a34210f4903

With patch
https://github.com/user-attachments/assets/47fe849f-14c3-431b-ad0b-e5f942e484eb

#### Unselected Left button has focus outline

Before
https://github.com/user-attachments/assets/84f3ade2-aafd-49f6-a914-b9dae098a4ee

With patch
https://github.com/user-attachments/assets/c48d8cf2-22a7-496d-9372-24154a32591a

## Use of AI Tools

none

@sabernhardt
7 weeks ago

Before patch: alignment options in the Image details dialog do not show that 'None' is selected

#2 @sabernhardt
7 weeks ago

  • Description modified (diff)

@wildworks commented on PR #11680:


6 weeks ago
#3

What are your thoughts on applying a 3px border to all four sides, rather than just the bottom?

https://github.com/user-attachments/assets/019fa96d-824e-4210-a5ed-0a68e512d630
https://github.com/user-attachments/assets/f4cb1cce-6235-4a7f-9ff8-0d2fb035f3c7

@sabernhardt commented on PR #11680:


5 weeks 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.

https://github.com/user-attachments/assets/f731d0e8-6958-4cff-a38a-fc5cb938e352

The hover state is the same as the default state:

https://github.com/user-attachments/assets/588e79a5-2abb-4f19-b412-4c2dd5623281

@wildworks commented on PR #11680:


5 weeks ago
#5

Thanks for the suggestion.Personally, I believe the third approach is the best. I find it particularly intuitive compared to the other two, especially when the active button is in focus. The focus color does not conflict with the button's default outline.

https://github.com/user-attachments/assets/9aae225e-0f16-430c-9de7-fc5829a784f4

#6 @manhar
4 weeks 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 weeks ago

#8 @joedolson
3 weeks ago

  • Milestone changed from Awaiting Review to 7.1
  • Owner set to joedolson
  • Status changed from new to 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.

#9 @joedolson
9 days ago

  • Keywords commit added

#10 @joedolson
9 days ago

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

In 62467:

Administration: Fix button active states in high contrast mode.

Adds CSS to distinguish button selected or active states in Windows High Contrast Mode.

Props sabernhardt, wildworks, manhar, joedolson.
Fixes #65153.

#11 @joedolson
9 days ago

  • Keywords dev-feedback added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport to 7.0 branch.

#12 @wildworks
6 days 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.

@wildworks
6 days ago

Customizer: Style for an active Publish Settings button

Note: See TracTickets for help on using tickets.