Allow :focus-visible pseudo-selector to be set in theme.json#68521
Allow :focus-visible pseudo-selector to be set in theme.json#68521carolinan merged 5 commits intoWordPress:trunkfrom
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
carolinan
left a comment
There was a problem hiding this comment.
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. |
|
Added to the 6.8 project board so we can update this on Gutenberg alongside Trac ticket 62906. |
|
Is the conclusion that it is working as long as there is no focus style? |
@carolinan, can you test it again and review my last commit? I think the order in VALID_ELEMENT_PSEUDO_SELECTORS is correct and the |
|
Thank you for the update, I think it is working now. |
Add the `:focus-visible` pseudo selector as a valid element in the `theme.json` schema. See also WordPress/gutenberg#68521. Props huubl, audrasjb, poena, sabernhardt, afercia, annebovelett. Fixes #62906. git-svn-id: https://develop.svn.wordpress.org/trunk@59854 602fd350-edb4-49c9-b593-d223f7449a82
Add the `:focus-visible` pseudo selector as a valid element in the `theme.json` schema. See also WordPress/gutenberg#68521. Props huubl, audrasjb, poena, sabernhardt, afercia, annebovelett. Fixes #62906. Built from https://develop.svn.wordpress.org/trunk@59854 git-svn-id: http://core.svn.wordpress.org/trunk@59196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
The related core ticket (https://core.trac.wordpress.org/ticket/62906) is merged. |
Add the `:focus-visible` pseudo selector as a valid element in the `theme.json` schema. See also WordPress/gutenberg#68521. Props huubl, audrasjb, poena, sabernhardt, afercia, annebovelett. Fixes #62906. Built from https://develop.svn.wordpress.org/trunk@59854 git-svn-id: https://core.svn.wordpress.org/trunk@59196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…ss#68521) * Allow :focus-visible pseudo-selector to be set in theme.json Co-authored-by: huubl <huubl@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: audrasjb <audrasjb@git.wordpress.org> Co-authored-by: joedolson <joedolson@git.wordpress.org> Co-authored-by: sabernhardt <sabernhardt@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: Bovelett <annebovelett@git.wordpress.org>
Add the `:focus-visible` pseudo selector as a valid element in the `theme.json` schema. See also WordPress/gutenberg#68521. Props huubl, audrasjb, poena, sabernhardt, afercia, annebovelett. Fixes #62906. git-svn-id: https://develop.svn.wordpress.org/trunk@59854 602fd350-edb4-49c9-b593-d223f7449a82
…ss#68521) * Allow :focus-visible pseudo-selector to be set in theme.json Co-authored-by: huubl <huubl@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: audrasjb <audrasjb@git.wordpress.org> Co-authored-by: joedolson <joedolson@git.wordpress.org> Co-authored-by: sabernhardt <sabernhardt@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: Bovelett <annebovelett@git.wordpress.org>
Fixes #68520
What?
This PR adds support for the
:focus-visiblepseudo-class intheme.jsonby including it in theVALID_ELEMENT_PSEUDO_SELECTORSlist.Why?
Currently, the
:focus-visiblepseudo-class cannot be set viatheme.jsonbecause it is not included in theVALID_ELEMENT_PSEUDO_SELECTORSlist. This limitation makes it difficult to implement enhanced focus styles specifically for keyboard users, impacting accessibility. Adding:focus-visiblewill allow themes to provide better focus indicators, improving the overall user experience for keyboard navigation.How?
The PR updates the
VALID_ELEMENT_PSEUDO_SELECTORSarray inclass-wp-theme-json-gutenberg.phpby adding:focus-visible. This change allows the:focus-visiblepseudo-class to be used directly withintheme.jsonfiles.Testing Instructions
theme.json.:focus-visiblepseudo-class intheme.json. For example:{ "styles": { "elements": { "button": { "color": { "background": "black", "text": "white" }, ":focus": { "outline": { "color": "green", "offset": "5px" } }, ":focus-visible": { "outline": { "color": "red", "style": "dotted" } } } } } }Testing Instructions for Keyboard
Screenshots or screencast