fix(editor): use native drag events on anchorElem for full-width drop targeting#102
Closed
zacharias-ona wants to merge 1 commit into
Closed
fix(editor): use native drag events on anchorElem for full-width drop targeting#102zacharias-ona wants to merge 1 commit into
zacharias-ona wants to merge 1 commit into
Conversation
… 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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
[shepherd] Closing — issue #99 is already closed. This PR is a duplicate. |
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.
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 LexicalcontentEditable. Lexical'sDRAGOVER_COMMAND/DROP_COMMANDonly fire when the cursor is over thecontentEditable, 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
Lexical dispatches
DRAGOVER_COMMAND/DROP_COMMANDfrom its own event listeners on thecontentEditableelement. 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
DRAGOVER_COMMAND/DROP_COMMANDhandlers with nativedragover/droplisteners on theanchorElem— this covers the full container width including the handle areauseUnboundedSearch) so the cursor can stay in the handle columnCOMMAND_PRIORITY_HIGH,DRAGOVER_COMMAND,DROP_COMMAND,mergeRegister)Closes #99