Repository navigation
Conversation
Changed break-all to use word-break for better readability.
|
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. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @himanshupathak95! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
juanfra
left a comment
There was a problem hiding this comment.
Thanks for your PR @himanshupathak95
It's testing nicely to me.
Screen.Recording.2024-11-19.at.18.12.50.mov
Can you please add an entry on the unreleased section of the changelog for components?
mirka
left a comment
There was a problem hiding this comment.
We can see that the original rule was put in place (#63916) with a pretty specific case in mind — a URL with a hyphen in the middle, like https://m.media-amazon.com/images/M/MV5BOTI5ZTNkYWQtNDg2Mi00MTBmLTliMGItNTI5YWI5OTZkM2Y2XkEyXkFqcGdeQXVyNzU1NzE3NTg@._V1_QL75_UX500_CR0,47,500,281_.jpg.
I do understand that break-all is not acceptable for wrapping (even if it's fine for truncation) in normal text, so I think reverting to word-break: normal is sensible.
Though we will see non-ideal wrapping for certain URLs, I think it's an acceptable compromise as long as they don't overflow and break the container, as was the original intent of the break-all:
cc @ciampo for a gut check.
| line-height: 16px; | ||
| color: ${ LIGHTER_TEXT_COLOR }; | ||
| word-break: break-all; | ||
| word-break: break-word; |
There was a problem hiding this comment.
word-break: break-word is deprecated, so we should use the non-deprecated equivalent:
| word-break: break-word; | |
| overflow-wrap: anywhere; |
There was a problem hiding this comment.
Hey @mirka, Thanks for the suggestion.
I have made the suggested changes. Please let me know if there is anything else that can be done.
Replace deprecated `word-break: break-word` with the modern equivalent `overflow-wrap: anywhere` to handle text wrapping. This change maintains the same text wrapping behavior while using the current standard CSS property.
@himanshupathak95 When making changes to WordPress components, it’s important to add a changelog entry in packages/components/CHANGELOG.md. At the top of this file, you’ll find an “Unreleased” section, which is where you should add your entry. This ensures the changes are included in the next release. Within the “Unreleased” section, there are sub-sections like “Bug Fixes” and “Enhancements.” Add your entry under the most appropriate sub-section, following the standard format: |
|
Thanks, @juanfra for the suggestion. I have now added the appropriate entry in Please let me know if there is anything else that can be done. |
| - `ToggleGroupControl`: Fix active background for `0` value ([#66855](https://github.com/WordPress/gutenberg/pull/66855)). | ||
| - `SlotFill`: Fix a bug where a stale value of `fillProps` could be used ([#67000](https://github.com/WordPress/gutenberg/pull/67000)). | ||
| - `ColorPicker`: Add accessible label for copy button ([#67094](https://github.com/WordPress/gutenberg/pull/67094)). | ||
| - `MenuItemHelpText`: Fix text wrapping to prevent unintended word breaks by using `overflow-wrap: anywhere` ([#67011](https://github.com/WordPress/gutenberg/pull/67011)). |
There was a problem hiding this comment.
Nit: adding a dot to represent the current component name
| - `MenuItemHelpText`: Fix text wrapping to prevent unintended word breaks by using `overflow-wrap: anywhere` ([#67011](https://github.com/WordPress/gutenberg/pull/67011)). | |
| - `Menu.ItemHelpText`: Fix text wrapping to prevent unintended word breaks by using `overflow-wrap: anywhere` ([#67011](https://github.com/WordPress/gutenberg/pull/67011)). |
| - `ToggleGroupControl`: Fix active background for `0` value ([#66855](https://github.com/WordPress/gutenberg/pull/66855)). | ||
| - `SlotFill`: Fix a bug where a stale value of `fillProps` could be used ([#67000](https://github.com/WordPress/gutenberg/pull/67000)). | ||
| - `ColorPicker`: Add accessible label for copy button ([#67094](https://github.com/WordPress/gutenberg/pull/67094)). | ||
| - `MenuItemHelpText`: Fix text wrapping to prevent unintended word breaks by using `overflow-wrap: anywhere` ([#67011](https://github.com/WordPress/gutenberg/pull/67011)). |
There was a problem hiding this comment.
Another nit, but I think that the ### Internal section would be more fitting for this CHANGELOG entry, given that the component is still a private API
There was a problem hiding this comment.
Hey @ciampo, Thanks for the suggestions.
I have addressed all the feedback. Please let me know if there is anything else that can be done.
mirka
left a comment
There was a problem hiding this comment.
Looks good, thank you for the follow-ups!
Fixes: #66998
What?
Changed CSS word-break property from
break-alltobreak-wordin meta fields for better text readability when content wraps.Why?
Currently, text in meta fields breaks incorrectly within words (e.g., "white" breaks as "whit e") due to using
break-all. This creates poor readability, especially for descriptions and long text content. Usingbreak-wordensures text breaks at appropriate word boundaries.Testing Instructions
functions.phpin your theme:Screenshots
Before
word-break: break-all;:After
word-break: break-word;: