Repository navigation
fix(editor): Cmd+A on WebKit, and macOS Ctrl navigation chords (#27) - #39
Merged
Merged
Conversation
Select-all only flagged the terminal state and left the DOM selection to the engine, and the kernel treated Ctrl as an alias of the command modifier. Both assumptions break on macOS WebKit: - WebKit's native SelectAll collapses to the document tail whenever the editable root's first child is a non-editable overlay -- exactly what hosts portal in (custom caret, remote-cursor layers). The user sees "Cmd+A flashes, then the selection vanishes". Blink is unaffected. - Ctrl+A/E/N/P/F/B are system text bindings (NSStandardKeyBindingResponding: paragraph start/end, next/previous line, forward/backward). Matching Ctrl+A as select-all hijacked paragraph-start into the terminal state, and the replayed whole-document range then teleported the caret to the top of the document. Ctrl+N/P landed unreliably and fought the arrow keys. Changes: - commandKey: split out foreignCommandKey (Ctrl on macOS, Cmd/Win elsewhere). Kernel shortcuts (undo/redo, select-all) now require the primary modifier and opt out on the foreign one, mirroring the @do-md/commands keymap. - Build the whole-document selection ourselves (selectAllDom_) instead of trusting the engine command: endpoints on the first/last VISIBLE text leaf, because WebKit paints no highlight for a container-endpoint range and blind model coordinates resolve into hidden syntax runs. The DOM write is deferred one macrotask -- WebKit keeps a selection installed inside a preventDefaulted keydown as data but never paints it -- and bails if the terminal state was cancelled in the meantime. - preventDefault on select-all, which also stops the desktop menu's native selectAll: from reaching the same broken engine command. - Replay pass: for the terminal state, confirm coverage of the first/last render block and return, otherwise rebuild via selectAllDom_, instead of replaying (uuid, offset) through the leaf-coordinate machinery -- that rebuilt range fought the live selection every pass (the reported flicker). - Probe the first/last *render* block (data-render-id) rather than first/lastElementChild: overlay scaffolding is legitimately outside our own selection, so probing it made the echo guard demote the terminal state. - Flush pending speculative input on the system navigation chords too, like the bare cursor keys: otherwise the armed pending timer wakes up after the caret has moved and writes the stale cursor back.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Select-all only flagged the terminal state and left the DOM selection to the engine, and the kernel treated Ctrl as an alias of the command modifier. Both assumptions break on macOS WebKit:
Changes:
What this changes
Which layer does this touch?
.packages/@do-md/core/) — GPL-3.0How it was verified
Contributor License Agreement
automated check asks.