fix(library): keep floating editor surfaces visible in fullscreen - #839
fix(library): keep floating editor surfaces visible in fullscreen#839FelixTJDietrich wants to merge 1 commit into
Conversation
Claudia-Anthropica
left a comment
There was a problem hiding this comment.
@FelixTJDietrich The editor-local portal routing is coherent for ordinary document-tree embeds, and the new coverage exercises those transitions. However, the containment check breaks when the embeddable editor is mounted inside a shadow root: fullscreen state is retargeted to the shadow host, so surfaces still portal outside the fullscreen subtree. Please resolve fullscreen state from the portal root's own tree and add shadow-DOM coverage.
| () => null | ||
| ) | ||
|
|
||
| if (portalContainer && fullscreenElement?.contains(portalContainer)) { |
There was a problem hiding this comment.
@FelixTJDietrich [medium] This check fails for editors mounted inside a shadow root. When the inner .apollon-editor enters fullscreen, document.fullscreenElement is retargeted to the shadow host, but host.contains(portalContainer) is false because shadow descendants belong to a separate node tree. The hook consequently returns document.body, leaving all floating surfaces outside the fullscreen subtree. Resolve the fullscreen element from the portal container's own getRootNode()—handling both Document and ShadowRoot—and add a shadow-root regression test.
🤖 Prompt for AI agents
In library/lib/components/ui/portalContainer.tsx, fullscreen containment is checked only against document.fullscreenElement, which is retargeted across shadow boundaries and leaves shadow-DOM editors portaling to document.body. Resolve the fullscreen element from the portal container's own root (Document or ShadowRoot) and cover a shadow-root mount in tests.
f14aec5 to
3aad60a
Compare
Claudia-Anthropica
left a comment
There was a problem hiding this comment.
@FelixTJDietrich The current head still resolves fullscreen exclusively through document.fullscreenElement. For an editor mounted in a shadow root, that value is retargeted to the shadow host, whose contains(portalContainer) check fails, so the prior medium finding remains unresolved and requires shadow-root-aware lookup plus regression coverage.
3aad60a to
fafdc2c
Compare
Claudia-Anthropica
left a comment
There was a problem hiding this comment.
@FelixTJDietrich The exact head still resolves fullscreen solely through document.fullscreenElement. For a shadow-DOM embed, that value is retargeted to the shadow host, whose contains(portalContainer) check fails, leaving floating surfaces outside the fullscreen subtree. Please use the portal container's Document or ShadowRoot fullscreen state and add shadow-root regression coverage.
|
Superseded by #841, which carries this work plus the rest of the fixes the Artemis integration needs on a single branch off |
Summary
Route editor-owned floating surfaces through an editor-local portal root when element-level fullscreen excludes the document body. This keeps popovers, selects, tooltips, color controls, and palette drag previews visible and interactive in subtree fullscreen without a global shared root or host-specific z-index workarounds.
Release note
Popovers, selects, tooltips, color pickers, and drag previews remain visible and interactive when an embedded editor enters fullscreen.
Implementation notes
document.bodywhenever body remains in the fullscreen subtree, preserving normal embedding and host dialog layering.document.fullscreenElementuses its local root.Steps for testing
pnpm lint && pnpm format:check && pnpm build && pnpm test.pnpm exec playwright test standalone/webapp/tests/e2e/fullscreen-portals.spec.ts.Screenshots / screencasts
Not attached: this fixes top-layer behavior rather than static appearance. The added Playwright test exercises the behavior in a real browser.
Checklist
pnpm lint && pnpm format:check && pnpm build && pnpm testlocally — green