-
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
Block Styles: Fix long strings of text without spaces overflow the block #34222
Block Styles: Fix long strings of text without spaces overflow the block #34222
Conversation
@arthur791004 one of the automated checks flagged https://github.com/WordPress/gutenberg/pull/34222/files#diff-3721697b4de86118e261dd67207c3022a76cb2882ed34fea6de180206c427601 It looks like the difference is actually line breaks in the returned string, I wonder if the css is actually loaded by the tests and having this effect |
I tested this locally with a8c-wp-env and found that twenty-twentyone and blank canvas weren't demonstrating the issue. The rule affecting the
Do you have more specific repro instructions? |
original issue: Automattic/wp-calypso#51249 |
@roo2 Oops...I'm sorry for that I forgot to say that the problem only happens when you view the post 😅 |
Ahh of course! sorry I missed that. I can reproduce the issue with Headings on the live site but not in the editor, with or without the cover block. Before:I can also confirm that applying this PR fixes the issue ✅ After: |
cc04984
to
9a7068a
Compare
9a7068a
to
690b83e
Compare
@roo2 Good catch 👍 I also tested the list before but I found that it works well because I wrap the string into paragraph 😅 |
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.
@@ -14,7 +14,7 @@ $blocks-block__margin: 0.5em; | |||
padding: calc(0.667em + 2px) calc(1.333em + 2px); // The extra 2px are added to size solids the same as the outline versions. | |||
text-align: center; | |||
text-decoration: none; | |||
overflow-wrap: break-word; | |||
word-break: break-word; // overflow-wrap doesn't work well if a link is wrapped in the div, so use word-break here. |
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 tested that buttons needs word-break
in order to wrap correctly wheras headings will wrap with overflow-wrap
alone (Tested in Chrome). 👍
But I couldn't work out why this is the case. I think that the comment is good for this interesting case. 👍
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 👍. Tested with headings in twentytwentyone. Though I don't know if it has any other side effects.
I'd say let's merge it and observe the impacts in prod.
Hey, so sorry to bring this back up, I only just ran into the changes from this branch last week. I wanted to check that you did precisely what you wanted to, here. Changing the default behaviors of all headers, lists, and paragraphs from W3C recommendations is possibly a larger change than you meant to make. Particularly I'm looking at the selectors that target |
I just ran into an issue caused by this change. This was on a theme that has not adopted FSE or anything like that, so this really seems like an overstep to me, to make this decision on behalf of all themes and affect global styles like this. |
@JakePT Do you have the steps to reproduce your issue? |
@arthur791004 Well the issue was just that the theme's CSS did not have This particulate site had some large text on desktop in a div that was slightly too small. This wasn't a problem because the text just overflowed a little bit and displayed fine, but after the update the words were broken so that the text could wrap. This looked much much worse. This change doesn't just affect headings that run out of space on mobile, it affects all headings at all times, including on desktop where text overflowing does not automatically mean that the text is being cropped. |
Agreeing with @JakePT , the css rules apply to global tags |
I'm sorry for the late reply. I totally agree with you all that I should not change the default behavior for p, h1 through h6, ol and ul. I'll revert the change for those elements. See #39846 |
Description
Currently, some of the themes set the
word-break: break-word;
oroverflow-wrap: break-word;
css to the heading block or paragraph block. For example,Independent Publisher 2
setsword-break: break-word
here to.entry-content
and heading and paragraph inherit that property. However, some of the themes (Twenty Twenty-One, Blank Canvas and so on) don't set that property so that the multi-line strings without spaces make the pages broken and generate the horizontal scrollbar on mobile devices.How has this been tested?
Screenshots
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).