-
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
Remove Button
component from social link block, replace with button
element
#61270
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. |
Size Change: +357 B (+0.02%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
Flaky tests detected in 2894d79. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8905885652
|
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.
Changes LGTM! Thanks for the quick update 🚀
✅ Updates are confined to the editor
✅ Social Links buttons appear the same on trunk and this PR
✅ Switching block styles that impact things like padding are displayed correctly
Before | After |
---|---|
I'm glad we only had to replicate a reduced set of the button components styles to achieve the same look. This will definitely help unblock the reduction of specificity for block style variations in #61032.
|
||
// The editor uses the button element, the frontend uses a link. | ||
// Therefore we unstyle the button element to make it more like the frontend. | ||
.wp-block-social-link-anchor { |
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.
Would we be able to lower the specificity here? If we ever want to support border or typography styling for this block, these styles could interfere.
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 was planning to look at dropping the specificity here over in #61032 as the block style variations need it as well
Dev Note (draft)As of WordPress 6.6, the social link block will no longer output the Themes targeting this class name should use the existing It's expected that most themes will be doing this already, so for most it should require no change. Why was this class name present?The class name was a side-effect of using the Why is this being changed?
|
What?
Fixes #61269
See #61032 (comment) for some background. This PR ties in to the work to improve the block variation styles feature as a means to achieving section styles. That work requires block specificity to be as low as possible, which this change helps with.
The social link block is currently using the
@wordpress/components
Button
component for its in canvas UI.This PR replaces it with the standard
button
element while keeping the same styles.Why?
There are a few reasons why using the
Button
component isn't a great idea for the editor canvas:components-button
class name - this is the reason why a dev note will be needed for this PR.@wordpress/components
components have, whereas for blocks we need to keep the specificity as low as possible so that extenders have a comfortable time implementing styles.@wordpress/components
component are not available in the editor canvas iframe, so this could mean breakage in the future.@wordpress/components
ever changes to a different visual style or has a refactor it could break the blockHow?
Use a normal
<button>
element. Some styles from the components package need to be replicated in the block, but this is fairly minimal.Testing Instructions
trunk
in the editor