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

Text in various blocks does not break/wrap at block boundaries (Gecko/Firefox default styling issue) #6049

Closed
ZebulanStanphill opened this issue Apr 6, 2018 · 11 comments · Fixed by #7472
Assignees
Labels
[Type] Bug An existing feature does not function as intended

Comments

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented Apr 6, 2018

Issue Overview

The following blocks do not break/wrap long strings of characters when they reaches the edge of the block in the editor:

  • Cover Image
  • Heading
  • Image
  • List
  • Paragraph
  • Pullquote
  • Quote
  • Subhead

Some blocks do break/wrap long strings of characters when they get too long, like the Button, Code, and Shortcode blocks. I would expect most other blocks to act the same, with the exception of some blocks like the Preformatted block and maybe Verse block.

Steps to Reproduce (for bugs)

  1. Insert a Paragraph block (or one of the other affected blocks listed above).
  2. Type a whole bunch of "w"s or other characters into the block to create a really long string of text.
  3. Notice that it does not break/wrap when it reaches the edge of the block, but instead just keeps on going all the way off the screen.
  4. Insert a Button block.
  5. Type a long string of characters again.
  6. Notice that the text is broken and wrapped when it gets too long, like you would expect.

Expected Behavior

Text in most blocks should always break and wrap once it reaches the boundaries of the block.

Current Behavior

Long strings of characters without any breaking characters like spaces or hyphens will just extend outside the boundaries of the block and go off the screen. This is especially noticeable when using nested blocks in columns.

Related Issues and/or PRs

#5130

@youknowriad
Copy link
Contributor

These blocks do wrap for me, you may have an extra style loaded by a plugin that breaks these blocks.

@youknowriad youknowriad added the [Status] Needs More Info Follow-up required in order to be actionable. label Apr 9, 2018
@ZebulanStanphill
Copy link
Member Author

ZebulanStanphill commented Apr 9, 2018

@youknowriad I just tested without any plugins and with the Twenty Seventeen theme, and the text is still not wrapping properly.

(I am using Gutenberg 2.6.)

image

(Ignore the blank text on the sidebar, that was something else I was messing around with when I took the screenshot.)

@youknowriad
Copy link
Contributor

youknowriad commented Apr 9, 2018

Here's the same thing for me, maybe it's browser specific, tested in Chrome Mac

screen shot 2018-04-09 at 18 33 21

Edit: Actually, I think it's a Firefox bug

@youknowriad
Copy link
Contributor

It looks like Firefox do wrap if you have have spaces. What's the correct behavior here @jasmussen ? Should we always wrap even without space?

@youknowriad youknowriad removed the [Status] Needs More Info Follow-up required in order to be actionable. label Apr 9, 2018
@ZebulanStanphill
Copy link
Member Author

ZebulanStanphill commented Apr 9, 2018

@youknowriad I just tested, and uninterrupted strings of characters are wrapped in Chromium, but not Firefox, which is the browser I am using. This issue is due to a difference in default browser styles. Firefox has overflow-wrap set to normal by default, but Chromium has it set to break-word by default.

Concerning what Gutenberg should do, I think always wrapping text when there is no other possible break point is a more useful behavior, both for the editor and the front-end.

This can be accomplished with the CSS property overflow-wrap being set to break-word.
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap

I tested, and changing the overflow-wrap value using CSS fixes the issue on Firefox.

@ZebulanStanphill ZebulanStanphill changed the title Text in various blocks does not break/wrap at block boundaries Text in various blocks does not break/wrap at block boundaries (Gecko/Firefox) Apr 9, 2018
@ZebulanStanphill ZebulanStanphill changed the title Text in various blocks does not break/wrap at block boundaries (Gecko/Firefox) Text in various blocks does not break/wrap at block boundaries (Gecko/Firefox default styling issue) Apr 9, 2018
@jasmussen
Copy link
Contributor

We should always wrap, ideally we break words, but if we can't we should break even without spaces. Can confirm this is also broken in Firefox for me. Going to take this one.

@jasmussen jasmussen added the [Type] Bug An existing feature does not function as intended label Apr 10, 2018
@jasmussen jasmussen self-assigned this Apr 10, 2018
jasmussen pushed a commit that referenced this issue Jun 22, 2018
This PR, maybe, fixes #6049. CC: @SuperGeniusZeb.

It is a one line code change, but this change is put into a highly unscoped and generic location, so I would appreciate both lots of testing and sanity checking that there are no adverse side-effects to doing this.

For reference, this is what we're using: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap
We could also have used https://developer.mozilla.org/en-US/docs/Web/CSS/word-break
jasmussen added a commit that referenced this issue Jun 26, 2018
* Fix text wrapping in Firefox.

This PR, maybe, fixes #6049. CC: @SuperGeniusZeb.

It is a one line code change, but this change is put into a highly unscoped and generic location, so I would appreciate both lots of testing and sanity checking that there are no adverse side-effects to doing this.

For reference, this is what we're using: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap
We could also have used https://developer.mozilla.org/en-US/docs/Web/CSS/word-break

* Scope to block list.

* docs: Tweak comment
@dcschreiber
Copy link

@jasmussen I am still seeing this on my website neutro.net when I view it on Chrome (Desktop windows 10 and android 11 version 86.0.4240.111) but no on firefox (mobile version 82.1.1).
The problem is when I have a long URL in a Code block.
You can see my site https://www.neutro.net/setting-neutro-up/
WordPress 5.5.1
Theme Neve Version: 2.8.3

image
Not sure if this is something you still do but I didn't find a better thread. Anyway, thanks for working on improving Gutenberg.

@jasmussen
Copy link
Contributor

Hi @shryber, it looks like the text that doesn't wrap in your screenshot is pasted inside a code block, correct?

I believe that at the moment, the code block intentionally does not provide any wrapping, but I can also see that it doesn't provide any overflow management either (such as a horizontal scrollbar). Please feel free to open a separate ticket and CC me and we can look at adding something there.

@dcschreiber
Copy link

@jasmussen Opened a new issue: #26600 (comment)
When you say CC here, should I tag you in the post or is there a specific feature I am missing?
Thanks!

@jasmussen
Copy link
Contributor

All good, it's on my radar now, thanks. I'll take a look next week, my day is about to wrap here.

@dcschreiber
Copy link

dcschreiber commented Oct 30, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@youknowriad @jasmussen @dcschreiber @ZebulanStanphill and others