Skip to content

[Bug] muya UI float tools (front button, table/preview toolbars) appear in source-code mode #4731

Closed

Description

@Jocs

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

  1. Open or create a document with a normal paragraph (bonus: also a table and a math / Mermaid block).
  2. Switch to source-code mode (View → Source Code Mode).
  3. Move the mouse over the editor area (over where a paragraph / table / diagram sits in the rendered document).
  4. 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

  1. added
    🐛 bug
    on Jun 26, 2026
  2. added a commit that references this issue on Jun 26, 2026
    6fd3ee6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bug🔭 area/editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions