Post Author Biography: Fix horizontal overflow with long unbroken text - #81018
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. |
im3dabasia
left a comment
There was a problem hiding this comment.
Thanks for the patch!
Matches what we already do on quote, pullquote, and embed, and I confirmed it fixes the reported overflow.
Non-blocking, for the record: overflow-wrap: break-word doesn't contribute to min-content sizing, so inside a Row (is-layout-flex) the block still overflows even with this patch.
Embed had the identical gap until #73109 added flex: 1 1 0%; min-width: 0 for flex groups, and Columns avoids it because .wp-block-column carries word-break: break-word (columns/style.scss:98), which unlike break-word on overflow-wrap does affect min-content. quote/pullquote/embed all share this gap, so it's a pre-existing pattern rather than anything this PR introduces, happy to leave it for a follow-up.
I'll need a second opinion on this before we merge!
| // This block has customizable padding, border-box makes that more predictable. | ||
| box-sizing: border-box; | ||
| white-space: pre-wrap; | ||
| overflow-wrap: break-word; |
There was a problem hiding this comment.
Small ask: could you add this trailing comment? // Break long strings of text without spaces so they don't overflow the block., keeps the rules greppable as a set.
There was a problem hiding this comment.
Hi @im3dabasia, thanks for the suggestion! I've added the trailing comment as requested.
|
Looks good. Thanks, @R1shabh-Gupta and @im3dabasia! |
What?
Closes #70849
Fixes horizontal overflow in the Post Author Biography block when the author's biography contains a long string of text with no spaces.
Why?
The
.wp-block-post-author-biographyselector setswhite-space: pre-wrap, which only wraps text at natural break points (spaces). If a biography contains one long unbroken run of characters, there's nowhere to wrap, so the text overflows the block horizontally and forces a scrollbar.How?
Added
overflow-wrap: break-word;to.wp-block-post-author-biography, so long unbroken text breaks within the block instead of overflowing it.Testing Instructions
Thisisaverylongstringofwordswithoutanyspacesorbreaksitjustkeepsgoingandgoingandwillcausehorizontalscrollingissuesbecausetherearenowordbreak(repeat until it's clearly wider than the content area).Screenshots or screencast
Use of AI Tools
None