Implement page-break-before/page-break-after: avoid
Categories
(Core :: Layout, task)
Tracking
()
People
(Reporter: fantasai.bugs, Unassigned)
References
(Blocks 2 open bugs, )
Details
(Keywords: dev-doc-needed, DevAdvocacy, Whiteboard: [DevRel:P3])
Attachments
(3 files)
Updated•8 years ago
|
Updated•8 years ago
|
Updated•7 years ago
|
Updated•6 years ago
|
Updated•2 years ago
|
I think this has been overlooked for lack of someone explaining it very simply, and the MDN documentation on version compatibility being wrong for some time. It states that break-after: avoid;
is supported since 72 which it was not (I didn't even see a specific mention in the patch notes for that version that says it was being supported).
I contributed separately on the Github Issue but it seems to have been looked over here too, so I'm happy to contribute some of the detail.
In the above posts I attached a test case document and screenshots that show the difference between the intended behaviour of break-after: avoid;
in Chromium, versus how the behaviour occurs in Firefox.
You can see that the title 'The Sandy Dunes of the Sahara' in Chromium is pushed to the next page in the print preview, which is the behaviour you expect from break-after:avoid;
, it doesn't let a page break come after the element. On Firefox by contrast you can see it has no effect at all. I chose an A4 page layout for this test document.
If you get a different result, make sure you are adding text to the paragraph above the H2 element sufficiently to force the heading to sit right before the page break in print preview. Remember that the correct behaviour is that the H2 element should never be the last element on the page, it should move down to join the paragraph below, or some text should remain under it on the previous page.
Can we set this bug to confirmed now?
Description
•