Skip to content

[css-overflow-4] [css-break] How does widows and similar properties affecting fragmentation interact with continue: discard? #9235

@andreubotella

Description

@andreubotella
<div style="continue: discard; height: 4lh; widows: 2;">
  Line 1<br>
  Line 2<br>
  Line 3<br>
  Line 4<br>
  Line 5
</div>

continue: discard makes the div into a fragmentainer and discards any content after the first break, forced or unforced. Since the height is 4lh, "Line 5" is certainly after the first break, but what about "Line 4"? If following fragments were not discarded, "Line 4" would be after the unforced break in order to avoid a single widow in the second fragment, but should that work the same if the second fragment is discarded?

The spec text for continue: discard does not say anything about how an unforced break is computed, so it is reasonable to assume that the same behavior applies as for non-discarding fragmentation. On the other hand, since the spec text for widows talks about lines in a fragment, you could see this as not applying to discarded fragments.

One thing to note is that the inital value of widows is 2, so it might come as a surprise to developers that the clamping sometimes happens one line earlier than it should, depending on the number of lines in the continue: discard box. And importantly, there would be no indication anywhere that it's widows that is causing this effect. (It certainly came as a surprise to me when working on my in-progress implementation of continue: discard in Chromium, taking me a while to realize it was not a bug in my layout code.)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Wednesday Afternoon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions