Skip to content

Report auto-resize changes when App portals open - #880

Open
mangeshraut712 wants to merge 2 commits into
modelcontextprotocol:mainfrom
mangeshraut712:fix/auto-resize-portal-686
Open

mangeshraut712 wants to merge 2 commits into
modelcontextprotocol:mainfrom
mangeshraut712:fix/auto-resize-portal-686

Conversation

@mangeshraut712

@mangeshraut712 mangeshraut712 commented Nov 29, 2026 •

Copy link
Copy Markdown

Fixes #686.

An absolutely positioned popover can increase scrollable content without resizing either box observed by App's auto-resize logic. Observe body subtree mutations and coalesce them with resize events on the same animation frame. Include body overflow, absolute children of the body, and absolute elements inside zero-height portal containers (as Mantine renders popovers) in the height calculation. Fixed overlays are not counted. Disconnect both observers and cancel any pending frame on cleanup.

Verification

  • Headless Chrome 158.0.8127.37, clean main at 87bcdc8c: a 100 px view stayed at 100 px after an absolutely positioned popover extended it to 330 px. Growing in-flow content to 180 px sent an update, confirming the observer was active.
  • With the patch, inserting the popover reported 330 px. After the in-flow content grew, hiding the popover reported 180 px, showing it again reported 330 px, and removing it reported 180 px. Reinserting it after cleanup emitted no update.
  • Mantine 8 Popover (the library in autoResize misses absolutely-positioned portal growth (popover opens → no size-changed) #686), at d37c853, in Chrome 153 with a host that resizes the iframe to each reported height: the dropdown sits in a zero-height <div> on <body> and reaches 528 px. Main and 0c1b8f1 reported 202 px; d37c853 reported 528 px and then 202 px when it closed. Direct and in-content popovers, a fixed overlay, shrinking content and 80 DOM mutations without a height change gave the same messages as 0c1b8f1.
  • bun test src: 360 passed, 0 failed. SDK build, Prettier, tsc --noEmit, and whitespace checks passed.

Overlap with #619

#619 changes height measurement in the same function, including use of body scroll height, but keeps the existing resize observer trigger. The mutation observer addresses the separate notification gap. The measurement code should be reconciled if either PR lands first.

AI assistance disclosure: OpenAI Codex and Anthropic Claude assisted with investigation, implementation, the Chrome regressions, local verification, and drafting this PR.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-29T17:18:31.097752Z
We couldn’t complete this review. Comment @codex review to try again.
0c1b8f1 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@mangeshraut712

Copy link
Copy Markdown
Author

Verified locally on commit 0c1b8f1d1503953d23eef50d100b90fccbcdf739. The SDK build passed, and bun test src finished with 360 passed, 0 failed. The headless Chrome regression (158.0.8127.37) passed: opening the portal raised the reported height from 100 px to 330 px. After the in-flow content grew, hiding or removing the portal returned the report to 180 px. Reinserting it after cleanup emitted no further size notification.

Hosted CI remains with the maintainers for approval. OpenAI Codex ran the local verification and drafted this update.

Mantine renders a popover as an absolute element inside a plain, zero-height
div appended to the body. That element is neither a direct absolute child of the
body nor part of the body's scroll overflow, so opening it sent no new height.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMDiXp8DnMSF8zyzneEdj3
@mangeshraut712

Copy link
Copy Markdown
Author

Follow-up in d37c853: the first version missed the repro in #686. A real Mantine 8 Popover renders its dropdown as an absolute element inside a zero-height <div> appended to <body>. That element is neither a direct absolute child of the body nor part of the body's scroll overflow, so 0c1b8f1 scheduled a measurement but still reported the old height. The measurement now also counts absolute elements inside zero-height portal containers.

Chrome 153, with a host page that resizes the iframe to each reported height. Each cell lists the heights reported, in px:

Case main 0c1b8f1 d37c853
Mantine Popover opened, then closed 202 202 202, 528, 202
Absolute popover in a static wrapper on <body> 216 216 216, 480, 216
Absolute popover as a direct child of <body> 216 216, 480, 216 216, 480, 216
Absolute popover inside a relative content root 216 216, 488, 216 216, 488, 216
Fixed overlay on <body> 216 216 216
80 DOM mutations without a height change 216, 234 216, 234 216, 234
Content shrinks from 716 px 716, 166 716, 166 716, 166
html, body { height: 100% } with a 40 px child 40 40 40

The mutation observer adds no messages when the height is unchanged (the 234 is a line of text being added). The last row is the collapse #619 addresses; this PR leaves it as main has it. bun test src gives 360 passed, and the SDK build, Prettier, tsc --noEmit and whitespace checks pass.

This branch has not been deployed

No deployments
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.

autoResize misses absolutely-positioned portal growth (popover opens → no size-changed)

1 participant