Repository navigation
fix(renderer): hide muya float tools in source-code mode - #4732
Merged
Merged
Conversation
In source mode the muya editor is sent behind the source editor via `z-index: -1` but stays in the DOM. Several muya float tools listen on a document-level mousemove and locate the hovered block with `document.elementsFromPoint`, which ignores z-index — so hovering over the source editor re-triggered the paragraph front button/menu, the table drag/column toolbars and the preview toolbar on top of CodeMirror. Add `pointer-events: none` to `.editor-wrapper.source` so the hidden editor subtree is excluded from hit-testing; the floats can no longer be re-triggered, while CodeMirror (a sibling, not a descendant) stays interactive. Fixes #4731 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4731
Summary
In source-code mode the WYSIWYG (muya) editor is only sent behind the source editor via
z-index: -1(.editor-wrapper.source) — it stays in the DOM and remains hit-testable. Four muya float tools listen on a document-levelmousemoveand locate the hovered block withdocument.elementsFromPoint(...), which returns elements regardless of z-index. So moving the mouse over the source editor found the muya block sitting underneath and re-showed muya's floating UI on top of CodeMirror:The legacy
hideAllFloatTools()call on entering source mode still hides already-open floats; the gap was that they could be re-triggered by hovering — a regression of #1101.The fix adds
pointer-events: noneto.editor-wrapper.source, removing the hidden editor subtree from hit-testing.document.elementsFromPointthen no longer returns the muya blocks, so none of the float tools can re-trigger. CodeMirror is a sibling of.editor-wrapper(not a descendant), so it stays fully interactive.Type of change
Test plan
document.elementsFromPointhit-testing behavior, which the happy-dom unit suite cannot reproduce, and the desktop e2e requires a full Electron build. A deterministic regression test belongs intest/e2e/view-modes.spec.ts(assertelementsFromPointover the editor returns no muya block in source mode) when run against a build.elementsFromPointover the editor returns the muya block (the leak) even though it sits behind CodeMirror in the hit-test stack.pointer-events: none): the muya block is excluded, while CodeMirror is still returned (i.e. remains interactive).Notes for reviewers
elementsFromPointignoresz-indexbut honorspointer-events: none/visibility: hidden/display: nonewas confirmed empirically in Chromium.pointer-events: noneis the most surgical of those options — it changes neither layout, paint, nor the editor's scroll/focus state, only its hit-testability, and it fixes all four float tools at the container level rather than patching each plugin individually.