-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Backport: Add support for pseudo elements for the block and its variations on theme.json #10523
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
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @pablost88, @WinsleyJ. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
|
Can we update the testing instructions to include changing the element of the button to |
753cbec to
decc403
Compare
…tions on theme.json
decc403 to
b0b1111
Compare
|
There was an issue with the backport - the nesting level of the fix was wrong. I pushed a fix for this. |
MaggieCabrera
left a comment
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.
This is testing well for me, and it fits what we already have in GB. This should have been backported to 6.9, so let's bring it in for 7.0
| * Test that block pseudo selectors are processed correctly within variations. | ||
| */ | ||
| public function test_block_variation_pseudo_selectors_are_processed() { | ||
| $theme_json = new WP_Theme_JSON_Gutenberg( |
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.
these need renaming I think
What?
Closes WordPress/gutenberg#55359
Adds support for pseudo elements on the
core/buttonblock for ( ':hover', ':focus', ':focus-visible', ':active' ) at the theme.json level. This is also allowing the block's variations to control the same pseudo elements, so now we can style hover for the outline variation too.Why?
This is needed ahead of WordPress/gutenberg#38277 since right now we are only supporting pseudo elements on links and button elements, we also want to support them at the block level. This PR brings them in alignment and opens the door to support things like :hover for other blocks that don't have an element (like group for example)
How?
By allowing the pseudo elements for the specific blocks in VALID_BLOCK_PSEUDO_SELECTORS, in a similar way we do for elements.
Testing Instructions
Add the following to your theme and check that it behaves as expected on the frontend:
Select a button block, and in the Advanced section, change the element of the button to , using the HTML element option, and check everything still works.
Screenshots or screencast
Trac ticket: https://core.trac.wordpress.org/ticket/64263#ticket
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.