Add 'wp-block-button__link' to the link selector's ':not' collection #42242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Add
wp-block-button__link
to the link selector's:not
collectionWhy?
In #40260 the
.wp-element-button
class was introduced and link element styles were applied to alla
anchor elements but excluded those with that class.However the class is only introduced on new content (or when old content is re-serialized). So any Button Blocks created prior to that change have the link styles applied.
Expected:
Before:
After:
How?
This adds the
.wp-block-button__link
to the anchor selector excluding any button that has that class from the anchor styles.Testing Instructions
Load a site that has content created prior to the #40260 change. (I imported the content from this site and used this page).
Configure your theme with a link color via theme.json :
Note that before this change the button block is rendered with the color assigned to the link element.
Apply the change and note that the button block is no longer rendered with the color assigned to the link element.