Skip to content

fix(editor): use native drag events on anchorElem for full-width drop targeting#102

Closed
zacharias-ona wants to merge 1 commit into
mainfrom
fix/block-drag-drop-horizontal-targeting
Closed

fix(editor): use native drag events on anchorElem for full-width drop targeting#102
zacharias-ona wants to merge 1 commit into
mainfrom
fix/block-drag-drop-horizontal-targeting

Conversation

@zacharias-ona
Copy link
Copy Markdown
Collaborator

Problem

Follow-up to #100 — the vertical dead zone fix didn't address the real issue. The drag handle sits in the anchorElem's 32px left padding, outside the Lexical contentEditable. Lexical's DRAGOVER_COMMAND / DROP_COMMAND only fire when the cursor is over the contentEditable, so dragging straight down or slightly left from the handle never triggers the drop indicator. The user has to move the cursor right into the text area for the drop to register.

Root cause

<div class="relative -ml-8 pl-8">   ← anchorElem (full width, 32px left padding)
  [drag handle]                      ← lives in the padding zone
  <ContentEditable />                ← Lexical events only fire here
</div>

Lexical dispatches DRAGOVER_COMMAND / DROP_COMMAND from its own event listeners on the contentEditable element. The drag handle and the padding area to its left are outside that element, so native drag events in that zone are never forwarded to Lexical's command system.

Fix

  • Replace Lexical DRAGOVER_COMMAND / DROP_COMMAND handlers with native dragover / drop listeners on the anchorElem — this covers the full container width including the handle area
  • Skip the horizontal bounds check during drag (useUnboundedSearch) so the cursor can stay in the handle column
  • Remove unused Lexical imports (COMMAND_PRIORITY_HIGH, DRAGOVER_COMMAND, DROP_COMMAND, mergeRegister)

Closes #99

… targeting

The drag handle sits in the anchorElem's left padding, outside the
Lexical contentEditable. Lexical's DRAGOVER_COMMAND / DROP_COMMAND only
fire on the contentEditable, so dragging straight down (or left) from
the handle never triggered the drop indicator.

Switch from Lexical drag commands to native dragover/drop listeners on
the anchorElem so the full container width — including the handle area —
is a valid drag target. Also skip the horizontal bounds check during
drag so the cursor can stay over the handle column.

Closes #99

Co-authored-by: Ona <no-reply@ona.com>
@zacharias-ona zacharias-ona added the ona-user PR created via interactive Ona session — no issue reference required label Apr 16, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

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

Project Deployment Actions Updated (UTC)
memo Ready Ready Preview, Comment Apr 16, 2026 6:55pm

Request Review

@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

[shepherd] Closing — issue #99 is already closed. This PR is a duplicate.

@zacharias-ona zacharias-ona deleted the fix/block-drag-drop-horizontal-targeting branch April 16, 2026 19:02
@zacharias-ona zacharias-ona restored the fix/block-drag-drop-horizontal-targeting branch April 16, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ona-user PR created via interactive Ona session — no issue reference required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block drag-and-drop requires exact cursor positioning

1 participant