Solution page breaks - #3193
Open
kylemonette wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 1:
js/src/pretext-printouts.js:Fixes
addSpilloverPages()incorrectly splitting a page mid-question when repaginating an authored-page worksheet or handout after a solution is revealed. The retreat loop that searches for a legal page break stopped one row too early, so a candidate split right after the first content row was never validated and could open a new page with blank writing space or separate a question from its own solution. The fix checks that candidate like any other, and adds a fallback: when no legal split exists before the point of overflow (an oversized question/solution/workspace group), it searches forward for the next legal boundary instead, isolating the oversized group onto its own page rather than producing an illegal split or leaving the layout stuck.Commit 2:
css/targets/print-worksheet/print-worksheet.scss:Fixes a Safari-only bug (as far as I know) where printing (or generating a PDF from) a worksheet or handout inserts a blank page after every page.
.onepagewas given a fixed height equal to the printable area, computed independently of the browser's own@page-margin-derived page height. A small rounding disagreement between the two causes Safari to paginate the tiny overflow onto its own blank page. Switching.onepagetoheight: autolets it size to its already-correctly-paginated content instead of a second, independently-rounded height, removing the mismatch.break-after/break-insideare added alongside the existingpage-break-*properties for broader engine support.