Repository navigation
Leave Mod-a and Mod-z to a host element focused beside the editor - #86
Merged
janglad merged 1 commit intoOct 6, 2026
Merged
Conversation
This commit introduces functionality to ensure that when a host element is focused beside the editor, keyboard shortcuts Mod-a, Mod-z, and Mod-Shift-z are correctly handled. Previously, these shortcuts were claimed by the editor, causing unintended behavior. The changes include updates to the keyboard event handling logic and the addition of tests to verify the correct behavior in various focus scenarios. - Implemented logic to prevent the editor from claiming shortcuts when a host element is focused. - Added tests to validate the new behavior for HOST9 scenarios. - Updated documentation to reflect the changes in shortcut handling. No breaking changes introduced.
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 56effc9. Configure here.
noudadrichem
approved these changes
Oct 6, 2026
janglad
deleted the
fix/web-4152-shortcuts-often-dont-work-if-composer-is-open
branch
October 6, 2026 16:25
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
The document key handler claimed Mod-a, Mod-z and Mod-Shift-z for any mounted editor that still had a caret, even while a host element held focus. A host's own undo or select-all never saw the key: the editor undid its last edit and stopped propagation in capture.
HOST9 already says focus on a host element is the host's. Keys now follow the same ownership.
Unchanged: focus on the body, or on a focusable wrapper around the root, still routes these keys to the editor.
Spec: HOST9 in
spec/rules/host.mdand the gate note inspec/packages/rendering/dom.mdare amended in this PR.Evidence
textEntryTarget.host9.test.ts, a focused host<button>beside the root with Mod-z or Mod-a:shouldHandleEditorKeyboardEventreturnedtrue.After: returns
falsefor Mod-a, Mod-z and Mod-Shift-z. Body focus and a focused wrapper still returntrue.src/utilstests pass. The full pen-dom, pen-react and pen-vue suites passed on the previous revision, which differed only by also covering Mod-y.Merge Danger
Door: two-way
Patch changeset for
@input/pen-dom,Breaking: no.Blast Radius: keyboard-routing
containsdoes not cross the boundary.Note
Medium Risk
Changes capture-phase routing for Mod-a/Mod-z/Mod-Shift-z; hosts that depended on editor undo/select-all while their own focused chrome sat outside the root will now receive those keys instead.
Overview
Fixes HOST9 keyboard ownership so Mod-a, Mod-z, and Mod-Shift-z are not stolen by the editor’s capture-phase document handler when focus sits on a host element beside the editor root (not inside the root and not on a wrapper that contains the root). Previously, any mounted editor with a leftover caret still routed those shortcuts to undo/select-all even while a host button or control held focus.
shouldHandleEditorKeyboardEventintextEntryTarget.tsnow returns false for document shortcuts in that focus case, before mapped-DOM-selection and selection-based routing. Unchanged: focus ondocument.bodyor on a focusable wrapper around the root still routes Mod-a/Mod-z to the editor.Adds
textEntryTarget.host9.test.ts, a patch changeset for@input/pen-dom, and spec updates inspec/rules/host.mdandspec/packages/rendering/dom.md.Reviewed by Cursor Bugbot for commit 56effc9. Bugbot is set up for automated code reviews on this repo. Configure here.