Skip to content

Conversation

@kalyanmantha-ui
Copy link

@kalyanmantha-ui kalyanmantha-ui commented Jan 27, 2026

Problem:
When dropping a file (e.g., image) onto a block, the editor currently highlights the block as "Selected" (adds the .ce-block--selected class). This leaves a persistent blue background behind the dropped content, which is incorrect behavior for a drag-and-drop action.

Fix:
Removed forced caret placement: The dragNDrop module was calling Caret.setToBlock(targetBlock) upon drop. This action forces the block to be focused/selected. I removed this call to prevent the block from capturing selection during a drop event.
Ensured Selection Clearing: Added a safety check to explicitly clear block selection (BlockSelection.clearSelection()) after the drop is processed, ensuring a clean state.

Verification:
Verified manually in a reproduction environment.
Result: Dropping a file now correctly inserts/uploads the file without toggling the "Selected" state of the block. No blue background appears.

Resolves #2980

Prevent block selection when dropping files. Resolves issue codex-team#2980.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop highlighting of block when dropping on file input

1 participant