Skip to content

Fix: honor break-before and break-after on floated elements#2728

Open
danfitz36 wants to merge 1 commit intoKozea:mainfrom
danfitz36:fix/break-on-floats-2277
Open

Fix: honor break-before and break-after on floated elements#2728
danfitz36 wants to merge 1 commit intoKozea:mainfrom
danfitz36:fix/break-on-floats-2277

Conversation

@danfitz36
Copy link
Copy Markdown

Summary

  • Floated elements bypassed break property handling because they are routed through _out_of_flow_layout instead of _in_flow_layout
  • Added forced page break detection for floats following the CSS Fragmentation spec: "User agents should also apply these properties to floated boxes whose containing block is in the normal flow of the root fragmented element."
  • Handles both break-before and break-after on floated elements

Test plan

  • Added test_float_break_after_page — verifies break-after: page on a float forces a page break
  • Added test_float_break_before_page — verifies break-before: page on a float forces a page break

Fixes #2277

Floated elements bypassed break property handling because they are
routed through _out_of_flow_layout instead of _in_flow_layout. Add
forced page break detection for floats following the CSS Fragmentation
spec: "User agents should also apply these properties to floated boxes
whose containing block is in the normal flow of the root fragmented
element."

Fixes Kozea#2277

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page breaks are not honored on floating elements

1 participant