Repository navigation
Description
Description
In source-code mode the WYSIWYG (muya) editor is only pushed behind the source editor via z-index: -1 (.editor-wrapper.source) — it stays in the DOM and remains hit-testable. Several muya float tools listen on a document-level mousemove and locate the hovered block with document.elementsFromPoint(...), which returns elements regardless of stacking / z-index. So moving the mouse over the source editor finds the muya block sitting underneath and shows muya's floating UI on top of the source editor.
Affected float tools: paragraph front button (and the front menu it opens), table drag bar, table column toolbar, and the preview toolbar (math / diagram blocks).
This is a regression of #1101 ("Hide all float box when change to source code mode", fixed in 2019 for the legacy engine). The legacy fix — hideAllFloatTools() on entering source mode — still runs, so already-open floats are hidden; the new gap is that they can be re-triggered by hovering while in source mode.
- Can you reproduce the issue?
Steps to Reproduce
- Open or create a document with a normal paragraph (bonus: also a table and a math / Mermaid block).
- Switch to source-code mode (View → Source Code Mode).
- Move the mouse over the editor area (over where a paragraph / table / diagram sits in the rendered document).
- The muya front button (drag handle) appears next to the paragraph; clicking it opens the paragraph front menu. Hovering a table shows the table drag/column toolbars; hovering a diagram/math block shows the preview toolbar.
Expected Behavior
No muya UI float tool should appear while in source-code mode. The muya UI should appear only in normal (WYSIWYG) editing mode.
Actual Behavior
muya float tools (front button + front menu, table drag bar, table column toolbar, preview toolbar) appear and are interactive on top of the source-code editor.
Screenshots / Logs
Root cause (technical): .editor-wrapper.source hides the editor visually (position: absolute; z-index: -1; overflow: hidden) but does not make it non-interactive. document.elementsFromPoint() ignores z-index and still returns the muya blocks behind the source editor, so the document-level mousemove handlers in paragraphFrontButton, tableDragBar, tableColumnToolbar, and previewToolBar re-show their floats.
Verified in Chromium: elementsFromPoint returns a z-index: -1 element, but excludes it once the subtree is pointer-events: none / visibility: hidden / display: none.
Operating System
macOS
MarkText Version
0.20.0-dev (develop)
OS Version
macOS 26.6
Reproducibility
- I can reliably reproduce this issue
Activity
fix(renderer): hide muya float tools in source-code mode (#4732)
Add a zoom/pan viewer and image export for rendered diagrams (#5554)