Repository navigation
Conversation
Forward keydown and beforeinput to block tools as cancelable editor:keydown / editor:beforeinput DOM events dispatched on the tool's input element, so tools can own Enter, Backspace, Tab and other keys inside the single contenteditable holder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Forward only editor:keydown for now; editor:beforeinput is deferred and documented as a known mobile/IME limitation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reversean
requested changes
Nov 3, 2026
|
|
||
| At `keydown` time the adapter reads the document selection: | ||
|
|
||
| - a collapsed caret, or a selection whose start and end are both in inputs of the same block → that block's adapter dispatches, on the input holding the selection start; |
Contributor
There was a problem hiding this comment.
Skip forwarding when the native keydown targets a button or another non-editing control. Chromium can retain a selection in a different block after focus moves to the control, causing Enter to edit that block and cancel the control's activation.
Contributor
There was a problem hiding this comment.
isContentEditable is inherited from the holder, so a plain <button> still returns true in Chromium and passes this guard. Exclude native controls explicitly so Enter on such a button cannot be forwarded to a stale selection in another block.
Forward editor:keydown only when the native event targets editable content. With focus on a button inside a block, Chromium can keep the selection in another block, so selection-only routing would let that block's tool cancel Enter and swallow the button's activation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
OpenSpec proposal
add-tool-input-events— proposal only, no implementation.Block tools can't react to Enter, Backspace, Tab or any other key today: the blocks holder is the single
contenteditableediting host, sokeydowntargets the holder and listeners on a tool's own elements never fire (capture or bubble). This blocks tools like List, Code and Table.The proposal:
@editorjs/dom-adaptersforwardskeydownto the block's tool as a bubbling, cancelableeditor:keydownCustomEvent, dispatched on the tool's input element, carrying the nativeKeyboardEventplus the model position (key,range,inputs).addEventListener(on an input, or once on their wrapper).keydown, so the editor's default (split, delete) and plugin shortcuts don't run.DOMAdapters, which initializes before other plugins.Deferred:
editor:beforeinputforwarding (needed for Android virtual keyboards / IME), Backspace merge wiring, line breaks, cross-input delete fix, re-keying inputs after array shifts.Files:
openspec/changes/add-tool-input-events/{proposal,design,tasks}.md,specs/dom-adapters/spec.md.openspec validate --strictpasses.🤖 Generated with Claude Code