Repository navigation
Themes: Fix disabled button semantics and focus visibility in theme installer - #13390
SainathPoojary wants to merge 6 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| .theme-browser .theme.active .theme-actions .button:not(.button-primary):focus { | ||
| background: #fff; | ||
| box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) #fff; | ||
| outline: 1px solid transparent; |
There was a problem hiding this comment.
Thanks, @afercia! I just pushed a fix to match the double box-shadow and border of the Core styles. Appreciate the feedback.
There was a problem hiding this comment.
I tested the keyboard navigation and it works perfectly!
joedolson
left a comment
There was a problem hiding this comment.
I didn't note every instance, but these are inconsistent with some prior choices we've made elsewhere, making buttons that are disabled focusable, so that they information within them is still communicated. See https://core.trac.wordpress.org/ticket/39074, for example.
We should try and be consistent about this. I think the issue is still accurate here, since when in the theme browser, the only place that it's communicated that a theme is currently active is this disabled button.
That may be an argument that we need to add that to the notice that shows a theme is installed, as well. But I think we should try and make our patterns consistent, one way or the other.
| <a class="button button-primary button-compact activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> | ||
| <# } else { #> | ||
| <button class="button button-primary button-compact disabled"><?php _ex( 'Activated', 'theme' ); ?></button> | ||
| <button class="button button-primary button-compact disabled" disabled><?php _ex( 'Activated', 'theme' ); ?></button> |
There was a problem hiding this comment.
Using the disabled attribute is inconsistent with what we do elsewhere; we've generally tried to use aria-disabled and leave the button focusable, so that the content of the button is still communicated. This is the pattern we've followed in the dashboard widget mover buttons, for example.
| ?> | ||
| <# if ( data.activate_url ) { #> | ||
| <a class="button button-primary button-compact disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a> | ||
| <a class="button button-primary button-compact disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>" aria-disabled="true" tabindex="-1"><?php _ex( 'Cannot Activate', 'theme' ); ?></a> |
There was a problem hiding this comment.
Possibly remove tabindex="-1"
|
Done @joedolson. Switched all button elements to One thing came up on the CSS side. The global Does this approach make sense or is there any other way we can handle the focus ring here? |
|
@SainathPoojary Another option would be to remove the Overall, avoiding introducing If you change the class, make sure that all functionality is still properly |
|
@afercia and I discussed this, and agreed that our preferred pattern is to use |
835aff0 to
fe4f9ed
Compare
|
I rebased on top of latest trunk. |
|
I pushed a commit to use aria-disabled buttons rather than links. I'm not addressing the focus style for aria-disabled buttons and I think it should be addressed in a separate ticket / PR as it is a broader change that impacts all the styles from buttons.css, colors, with a few |
…sabled controls. Most of the disabled controls in the Theme installer were rendered as `<a>` elements without a `href` attribute. Just a few of them were rendered as buttons when disabled. This change improves semantics, interaction, and accessibility by making all these controls buttons that are still focusable and that use `aria-disabled` instead of a `disabled` attribute. Developed in #13390 Props sainathpoojary, arkaprabhachowdhury, sanayasir, kthibault, nicoblandel, joedolson, afercia. Fixes #66038. git-svn-id: https://develop.svn.wordpress.org/trunk@64243 602fd350-edb4-49c9-b593-d223f7449a82
…sabled controls. Most of the disabled controls in the Theme installer were rendered as `<a>` elements without a `href` attribute. Just a few of them were rendered as buttons when disabled. This change improves semantics, interaction, and accessibility by making all these controls buttons that are still focusable and that use `aria-disabled` instead of a `disabled` attribute. Developed in WordPress/wordpress-develop#13390 Props sainathpoojary, arkaprabhachowdhury, sanayasir, kthibault, nicoblandel, joedolson, afercia. Fixes #66038. Built from https://develop.svn.wordpress.org/trunk@64243 git-svn-id: http://core.svn.wordpress.org/trunk@63394 1a063a9b-81f0-0310-95a4-ce76da25c4cd

This PR fixes two accessibility issues in the Theme Installer related to disabled buttons and focus visibility:
.disabledCSS class with proper semantic attributes (disabledfor<button>elements, andaria-disabled="true" tabindex="-1"for<a>elements). This removes them from the tab order.#ffffor secondary buttons on the active theme card. Previously, the default focus ring color blended exactly with the theme name background, making it invisible when reached via keyboard.Trac ticket: https://core.trac.wordpress.org/ticket/66038
Use of AI Tools
AI assistance: Yes
Tool(s): Github Copilot
Model(s): Claude Sonnet 4.6
Used for: Edge-case checks, and assistance with the PR description; implementation and testing were reviewed and verified 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.