Skip to content

Conversation

@jonathanhefner
Copy link
Member

Follow-up to #54.

The previous approach measured html/body elements which expand to fill the viewport, causing the iframe to be larger than necessary.

Fix by using CSS fit-content to measure the true minimum content size:

  • Temporarily set html to fit-content to shrink it to content
  • This automatically includes body margins
  • Cache last sent size to prevent feedback loops from style changes
  • Simplify scrollbar compensation (already 0 when no scrollbar)

🤖 Generated with Claude Code

The previous approach measured html/body elements which expand to fill
the viewport, causing the iframe to be larger than necessary.

Fix by using CSS fit-content to measure the true minimum content size:
- Temporarily set html to fit-content to shrink it to content
- This automatically includes body margins
- Cache last sent size to prevent feedback loops from style changes
- Simplify scrollbar compensation (already 0 when no scrollbar)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ochafik ochafik merged commit 1a6f237 into modelcontextprotocol:main Dec 1, 2025
1 check passed
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