Skip to content

fix: resolve layout crash#2821

Closed
VladaHarbour wants to merge 2 commits intomainfrom
sd-2498_layout-crash
Closed

fix: resolve layout crash#2821
VladaHarbour wants to merge 2 commits intomainfrom
sd-2498_layout-crash

Conversation

@VladaHarbour
Copy link
Copy Markdown
Contributor

No description provided.

@VladaHarbour VladaHarbour self-assigned this Apr 15, 2026
@linear
Copy link
Copy Markdown

linear bot commented Apr 15, 2026

Copy link
Copy Markdown

@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: 63ed2ed950

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +748 to +752
const rawTopMargin =
headerContentHeight > 0 ? Math.max(baseTopMargin, currentHeaderDistance + headerContentHeight) : baseTopMargin;
const minimumContentHeight = 1;
const maxAllowedTopMargin = pageHeight - effectiveBottomMargin - minimumContentHeight;
return Math.min(rawTopMargin, maxAllowedTopMargin);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep non-header pages from silently mutating margins

calculateEffectiveTopMargin now caps rawTopMargin against pageHeight - effectiveBottomMargin even when there is no header content, so configurations where top + bottom exceeds page height no longer trigger the existing non-positive-content-area failure path and instead silently rewrite the top margin. This changes layout semantics for explicit user/document margins (and can produce negative top margins when bottom alone exceeds page height), so the cap should be limited to header-inflation scenarios or otherwise preserve the invalid-margin validation behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added calculations for bottom margin in order to not exceed page

@VladaHarbour VladaHarbour force-pushed the sd-2498_layout-crash branch from c2dceb5 to 1b3fa23 Compare April 16, 2026 09:38
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants