w3c / w3c/csswg-drafts

[css-text] word-break:keep-all and overflow

Open
#4,286 2 comments 0 reactions 1 assignee View on GitHub

@frivoal is already working on this.

Since Sep 9, 2019.

css-text-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

word-break:keep-all does not suppress all wrapping opportunities, but in languages where the normal behavior is to allow breaking between letters, it suppresses a lot of them. This can lead to overflow if we end up with a particularly long string of unwrappable letters in a somewhat short line. That's not terribly different from having a long english word on a short line, except that this is in a language where the normal behavior is to allow wrapping in the middle of words, so there's an obvious solution as to how to avoid this overflow: revert back to allowing breaks inside words.

(Note: using overflow-wrap: break-all or overflow-wrap: anyhwere isn't the same, and isn't as good, because they allow wrapping at any point, even those that are unnatural for that language).

If overflow-wrap is normal (which is the common case), css-text-3 already says:

the restrictions introduced by word-break: keep-all may be relaxed to match word-break: normal if there are no otherwise-acceptable break points in the line.

I'm thinking that the "may" here isn't quite right. Authors should reliably know if using keep-all will cause overflow in some situations, in which case they should deal with it somehow, or if there are built-in protections. And since overflow is bad, I think we ought to deal with it.

Ideally, I'd say we should switch this "may" to a "must", but given the state of implementations, I don't think we should block level 3 on this, so I'd suggest putting it as a should in level 3, add tests to back it up, and make it a must in L4.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.