Skip to content
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: Use break-word instead of break-all in attribute description #67011

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

himanshupathak95
Copy link

Fixes: #66998

What?

Changed CSS word-break property from break-all to break-word in 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. Using break-word ensures text breaks at appropriate word boundaries.

Testing Instructions

  1. Add this test code to create a custom post type with meta fields in functions.php in your theme:
function init_test_meta_fields() {
   register_post_type(
       'landmark',
       array(
           'label'        => 'Landmark',
           'public'       => true,
           'supports'     => array( 'title', 'editor', 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', 'page-attributes', 'thumbnail', 'custom-fields', 'post-formats' ),
           'has_archive'  => true,
           'show_in_rest' => true,
       ),
   );
   register_meta(
       'post',
       'landmark_description',
       array(
           'object_subtype' => 'landmark',
           'label'          => 'Description',
           'show_in_rest'   => true,
           'single'         => true,
           'type'           => 'string',
           'default'        => 'Inspired by the Eiffel Tower, this red and white tower is one of Tokyo\'s most recognizable landmarks.',
       )
   );
}

add_action( 'init', 'init_test_meta_fields' );
  1. Create a new Landmark post
  2. Check the attributes >> content desctiption field in meta fields
  3. Verify text now breaks correctly at word boundaries
  4. Test with various content lengths including URLs and long words

Your paragraph text

Screenshots

Before word-break: break-all; :

1

After word-break: break-word; :

2

Changed break-all to use word-break for better readability.
Copy link

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: himanshupathak95 <[email protected]>
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: jasmussen <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 14, 2024
Copy link

👋 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.

@mirka mirka requested a review from a team November 14, 2024 22:00
@mirka mirka added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Truncate: Truncation breaks with break-all rather than break-word
2 participants