-
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
Fix Truncate component for long unbreakable text. #61137
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. |
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.
The change looks good to me, but I would appreciate a second opinion from folks who are more familiar with the Components package.
@WordPress/gutenberg-components mind taking a look at 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.
Thanks Marin for your review. |
Sorry I missed to add the |
Fixes #61125
Amends #60890
See #60860
What?
#60890 broke the display of text that uses the
Truncate
component making words always 'breakable'. When the Truncate component forces text in one line, we still need to make sure 'unbreakable' text can break otherwise the-webkit-line-clamp
CSS property will not work. However, when the Truncate component is set to force 2 or more lines, the text should not be forced to be 'breakable'.Why?
When the Truncate component forces text in one line, we still need to make sure 'unbreakable' text can break otherwise the
-webkit-line-clamp
CSS property will not work. However, when the Truncate component is set to force 2 or more lines, the text should not be forced to be 'breakable'.How?
Makes
Truncate
useword-break: break-all
only when-webkit-line-clamp
is1
.Testing Instructions
Note: other places to optionally check are, for example, the filename of the Site Logo image, see screenshot:
or the filename of the background image of a Group block.
Notice in these cases the element rendered by the Truncate component already receives some more custom CSS rules including
word-break: break-all
because filenames, like URLs, can be very long and 'unbreakable'. We could consider to remove the customword-break: break-all
set on these elements to be more clean, but keeping it doesn't harm much.Testing Instructions for Keyboard
Screenshots or screencast