Skip to content

[css-text-3] overflow-wrap: break-spaces can effect behavior even when there are previous breaking opportunities in the line #2003

@litherum

Description

@litherum

https://drafts.csswg.org/css-text-3/#propdef-overflow-wrap

overflow-wrap: break-word says:

An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line.

overflow-wrap: break-spaces says:

Any sequence of preserved white space ... must be broken ... before the first space in the sequence if none would fit and both break-word and break-spaces are specified.

Then, there's a note that says:

This last clause is due to the fact that 'overflow-wrap: break-words'' allows breaks between any two characters to avoid overflow

But this isn't quite right. break-word only kicks in when there are no otherwise-acceptable break points in the line, but break-spaces applies in all situations.

Consider the following example, styled with white-space: pre-wrap; overflow-wrap: break-word break-spaces, where the square represents a space character:
screen shot 2017-11-21 at 11 09 21 am
In this situation, break-word is irrelevant, so it seems that there should be a line break before the word "text".

However, in this example:
screen shot 2017-11-21 at 11 13 38 am
break-word kicks in, and would find the breaking position between the "t" and the space character, so it seems that the string should break between these characters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions