Skip to content

SD-1708: Footnotes overlap footer and fall off the page#2021

Open
VladaHarbour wants to merge 2 commits intomainfrom
sd-1708_footnotes-overlap
Open

SD-1708: Footnotes overlap footer and fall off the page#2021
VladaHarbour wants to merge 2 commits intomainfrom
sd-1708_footnotes-overlap

Conversation

@VladaHarbour
Copy link
Contributor

Hi team! Here I had to remove default top/bottom padding for table cells because it caused inconsistency between Superdoc and Word layouts(Superdoc tables occupied more space on the page that similar ones in Word). Also it caused issues in footnotes reserves calculations.

@linear
Copy link

linear bot commented Feb 13, 2026

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e093b892f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1693 to +1694
reserves = nextReserves;
if (reservesStable) break;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Re-layout after updating reserves on the last pass

When the for loop exits because MAX_FOOTNOTE_LAYOUT_PASSES is reached (without hitting reservesStable), reserves is updated to nextReserves but layout still reflects the previous reserve vector. The subsequent plan/injection phase then runs against a layout that may not match reserves, and because reservesDiffer compares against reserves (not the reserve vector actually used to produce layout), this mismatch can slip through and place footnotes in the wrong reserved band. In long/oscillating footnote pagination cases this can reintroduce overlap/truncation near the footer.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladaHarbour worth double checking and adding a comment if relevant or not

@github-actions
Copy link
Contributor

Visual diffs detected

Pixel differences were found in visual tests. This is not blocking — reproduce locally with cd tests/visual && pnpm docs:download && pnpm test to review diffs.

Copy link
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @VladaHarbour!

let reserves = plan.reserves;

// If any reserves, relayout once, then re-assign and inject.
const MAX_FOOTNOTE_LAYOUT_PASSES = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to module level -- other layout limits in the pipeline are defined at the top of the file. also, if this loop maxes out without stabilizing, a console.warn would help debugging.

layout = layoutDocument(currentBlocks, currentMeasures, {
...options,
footnoteReservedByPageIndex: reserves,
headerContentHeights,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same layoutDocument(...) call with same options appears 3x here. a small relayout(reserves) helper would clean this up.

({ measuresById } = await measureFootnoteBlocks(collectFootnoteIdsByColumn(idsByColumn)));
plan = computeFootnoteLayoutPlan(layout, idsByColumn, measuresById, reserves, pageColumns);
const nextReserves = plan.reserves;
const reservesStable =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no test hits the multi-pass path. one where footnotes shift pages between passes would catch regressions.


// Cell height includes: para0Height + 10 + para1Height + 20 + padding (default 2 top + 2 bottom)
const expectedCellHeight = para0Height + 10 + para1Height + 20 + 4;
// Cell height includes: para0Height + 10 + para1Height + 20 + padding (default 0 top + 0 bottom)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+ 0 on the next line is leftover from replacing + 4 -- just drop it. same for this comment: if padding is 0, drop the mention.

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.

2 participants