fix(pdf): keep a stay whole across a page edge

An accommodation could be cut in half by a page break — the check-in time
at the foot of one sheet, the hotel name and address at the head of the
next, under a repeated day header that read like a duplicate day. Place and
note cards have carried break-inside: avoid all along; this one never did.

It could always happen to a day that overflowed its page. Letting the days
flow means content meets a page edge far more often, which is how it turned
up. Printing the same trip through Chromium: two torn stays before, none
after.
This commit is contained in:
Maurice
2026-07-29 20:05:25 +02:00
committed by Maurice
parent 5dbb2db3ee
commit eb817dea65
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -1004,4 +1004,14 @@ describe('page breaks between days (#1292)', () => {
expect(() => toggle()!.click()).not.toThrow()
})
// Verified against a real print engine: without this rule Chromium tore a stay
// across the page edge, the check-in time on one sheet and the hotel name on
// the next. Place and note cards already carried it.
it('FE-PDF-BREAK-007: a stay may not be split by a page edge', async () => {
await downloadTripPDF(twoDays)
const html = getIframe()!.srcdoc
const rule = html.slice(html.indexOf('.day-accommodation {'))
expect(rule.slice(0, rule.indexOf('}'))).toContain('break-inside: avoid')
})
})
+4
View File
@@ -565,6 +565,10 @@ export async function downloadTripPDF({ trip, days, places, assignments = {}, ca
flex: 1 1 45%; min-width: 200px; margin: 4px 0; padding: 10px;
border: 2px solid #e2e8f0; border-radius: 12px;
display: flex; flex-direction: column;
/* Place and note cards have said this all along; without it a stay is torn
in half by a page edge, its check-in time on one sheet and the hotel name
on the next. Rare while every day started a page, common once they flow. */
break-inside: avoid; page-break-inside: avoid;
}
.day-accommodation-title {
font-size: 16px; font-weight: 600; text-align: center;