-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow :focus-visible pseudo-selector to be set in theme.json #68521
base: trunk
Are you sure you want to change the base?
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
7e46ebb
to
daf6aae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should include this.
The changes to the PHP file needs to be backported to WordPress, so a new trac ticket and PR needs to be created and the changelog entry needs to be added.
Hi @carolinan, I created a trac ticket and created a pull request to wordpress-develop. But not sure what to do for "the changelog entry needs to be added"? |
I am testing this again today and I am not able to make it work. It doesn't look like the correct CSS for |
If you look at the test results, there is an item that says "verify core backport changelog". If you open the details, it says: https://github.com/WordPress/gutenberg/blob/trunk/backport-changelog/readme.md |
Do you think the order may be wrong?
Pinging @sabernhardt for your expertise 😄 |
Thanks for asking. My expertise with this list just involves moving To me, putting However, my quick test did not behave exactly as I expected.
|
A potential source of confusion may be that the quick test uses Reading the MDN page about focucs-visible, today I learned that the browser heuristics to determine whether to use
In fact, the W3C Selectors Level 4 spec doesn't mention any specific device.
So it appears that 'most helpful to the user' always includes input fields. |
Fixes #68520
What?
This PR adds support for the
:focus-visible
pseudo-class intheme.json
by including it in theVALID_ELEMENT_PSEUDO_SELECTORS
list.Why?
Currently, the
:focus-visible
pseudo-class cannot be set viatheme.json
because it is not included in theVALID_ELEMENT_PSEUDO_SELECTORS
list. This limitation makes it difficult to implement enhanced focus styles specifically for keyboard users, impacting accessibility. Adding:focus-visible
will allow themes to provide better focus indicators, improving the overall user experience for keyboard navigation.How?
The PR updates the
VALID_ELEMENT_PSEUDO_SELECTORS
array inclass-wp-theme-json-gutenberg.php
by adding:focus-visible
. This change allows the:focus-visible
pseudo-class to be used directly withintheme.json
files.Testing Instructions
theme.json
.:focus-visible
pseudo-class intheme.json
. For example:Testing Instructions for Keyboard
Screenshots or screencast