-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Post Author Biography: Add Border Support #64615
Post Author Biography: Add Border Support #64615
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: +176 B (+0.01%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
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.
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.
LGTM 🚢
✅ Global styles apply correctly
✅ Block instance styles override global styles
✅ Styles apply consistently between editor and frontend
✅ Box sizing allows parent to enforce width
✅ Default display of border controls matches spacing controls
Screen.Recording.2024-08-20.at.11.59.00.AM.mp4
.wp-block-post-author-biography { | ||
// This block has customizable padding, border-box makes that more predictable. | ||
box-sizing: border-box; | ||
} |
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.
It might be a good follow-up to see if we can make a simple generic selector to set border-box sizing on all blocks.
I don't know if we can get away with it but it seems excessive that we have to add a separate rule for almost every block, bloating the CSS in each request.
Maybe it's worth trying something like:
// Or .wp-block-* ?
.wp-block {
box-sizing: border-box;
}
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.
Can we use css like this for globally?
[class*="wp-block-"][style*="border"] {
box-sizing: border-box;
}
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.
That looks promising. The catch is that we'd have to make sure there are wp-block-*
classnames on all elements that receive the inline styles.
Some blocks skip serialization and apply styles on inner elements.
I pulled up the obvious example of wp-block-search
, whose inline border styles are applied conditionally on the input and button. Fortunately, these elements have wp-block-*
classes, so it'd work.
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.
Agreed 👍
We need to review all blocks and verify that box-sizing: border-box is correctly applied (if we use box-sizing:border-box
globally)
especially since some blocks have borders on inner elements.
Can I create separate PR for this?
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 didn't mean to derail the PR, that's why I suggested it as a good follow-up given the obvious edge cases.
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.
Understood.
I appreciate your suggestion. I agree that it’s important to review and ensure box-sizing: border-box
is correctly applied across all blocks, especially given the edge cases with borders on inner elements. I will proceed with creating a separate PR to address this follow-up. Thank you for highlighting it!
Thank you both for reviewing this PR. |
I've taken the liberty to merge this one so I can update the border support tracking issue. Thanks again for the work here @shail-mehta 👍 |
Co-authored-by: shail-mehta <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]>
What?
Add border block support to the
Post Author Biography
block.Part of #43247
Why?
Post Author Biography
block is missing border support.How?
Add the border block support in block.json.
Testing Instructions
Post Author Biography
block's border is Configurable via Global Styles.Post Author Biography
block and Apply the border Styles.Post Author Biography
block styles take precedence over global Styles.Post Author Biography
block borders display correctly in both the Editor and Frontend.Screenshots or Screencast
add-border-support-in-author-biography.mp4