diff --git a/tests/layout/test_float.py b/tests/layout/test_float.py
index d3b1bc234..62f1aa784 100644
--- a/tests/layout/test_float.py
+++ b/tests/layout/test_float.py
@@ -271,6 +271,27 @@ def test_floats_page_breaks_2():
assert positions_y == [[10], [10]]
+@assert_no_logs
+def test_floats_page_breaks_side_by_side():
+ # Don’t move an overflowing float when it’s next to another float.
+ page, = render_pages('''
+
+
left
+ right
+ ''')
+
+ divs = [
+ box for box in page.descendants()
+ if box.element_tag == 'div' and box.is_floated()]
+ assert [(div.position_x, div.position_y) for div in divs] == [
+ (10, 10), (26, 10)]
+
+
@assert_no_logs
def test_floats_page_breaks_3():
# Tests floated images shorter than the page
diff --git a/weasyprint/layout/block.py b/weasyprint/layout/block.py
index e259adb9a..345d91829 100644
--- a/weasyprint/layout/block.py
+++ b/weasyprint/layout/block.py
@@ -270,7 +270,8 @@ def _out_of_flow_layout(context, box, index, child, new_children,
page_overflow = context.overflows_page(
bottom_space, new_child.position_y + new_child.height)
add_child = (
- (page_is_empty and not new_children) or
+ (page_is_empty and (
+ not new_children or new_child.position_y == box.content_box_y())) or
not page_overflow or
box.is_monolithic())
if add_child: