Skip to content

Conversation

@pepijndevos
Copy link
Contributor

@pepijndevos pepijndevos commented Jan 12, 2026

📝 Summary

When Marimo is embedded in a larger app inside an iframe, it will steal focus and break keyboard navigation.

🔍 Description of Changes

In some places the code already checks if it's being embedded, but in two other places it unconditionally steals focus, even when embedded in an iframe. This PR simply adds checks to only focus itself when not embedded.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.
@vercel
Copy link

vercel bot commented Jan 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 13, 2026 2:49pm
Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

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

i don't think we quite want this, especially on molab.

we still want some of these autofocus interactions, regardless if its in an iframe or not. an alternative maybe could be to check that document.hasFocus() is also true, so we don't still focus from outside the iframe

@pepijndevos
Copy link
Contributor Author

That makes sense and I've confirmed that works for my app

mscolnick
mscolnick previously approved these changes Jan 13, 2026
@mscolnick
Copy link
Contributor

looks like some tests are currently failing

@mscolnick mscolnick added the enhancement New feature or request label Jan 13, 2026
@mscolnick mscolnick merged commit 8b28c2c into marimo-team:main Jan 13, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

2 participants