fix(editor): a bare re-render no longer ejects the user from INSERT - #6
Merged
myrddian merged 1 commit intoAug 1, 2026
Merged
Conversation
updateFromServer took the server's mode on every reuse. But a screen re-sending its tree unchanged arrives here as a reuse, so any repaint dropped a live edit back to the screen's declared mode. That is exactly what viewport.resize will do once the server honours it, and on mobile the on-screen keyboard opening fires a resize — so the keyboard appearing would have ejected the user from INSERT. Mode is now taken from the server only when the server's declaration actually changed (mode, readOnly, or content). A genuine change is still a hard reset, as before; a bare re-render leaves the user alone. This is the smaller half of ADR-036's sequenced follow-up. Full tree reconciliation remains worthwhile for DOM churn and multiple concurrent editors, but it is not a prerequisite for resize — this is. Co-Authored-By: Claude Opus 5 <[email protected]>
myrddian
added a commit
that referenced
this pull request
Aug 1, 2026
fix(editor): a bare re-render no longer ejects the user from INSERT (re-land of #6)
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.
Stacked on #5 — review that first; this diff is 3 files on top of it.
Problem
updateFromServertook the server's mode on every reuse. A screen re-sending its tree unchanged arrives here as a reuse, so any repaint dropped a live edit back to the screen's declared mode.That is precisely what
viewport.resizewill do once the server honours it — and on mobile, the on-screen keyboard opening fires a resize. The keyboard appearing would have ejected the user from INSERT.Change
Mode is taken from the server only when the server's declaration actually changed —
mode,readOnly, orcontent. A genuine change is still a hard reset, exactly as before. A bare re-render leaves the user where they are.Why this instead of the full reconciler
ADR-036's follow-up assumed reconciling paint was the prerequisite for safe resize. Testing the assumption first showed it isn't: the destructive part of a repaint is this mode reset, not the DOM teardown — the DOM already reuses the editor's node, and #5 restores focus after re-parenting.
Full tree reconciliation is still worth doing — DOM churn, and it would retire the
activeEditorsingleton and thefindEditorIdpre-scan so multiple editors can coexist. But it is not on the critical path toviewport.resize. This is.Verification
71 passing across 11 filestsc --noEmitclean, bundle buildsion a NORMAL-declared editor, an identical element is re-sent, and the mode stays[INSERT]Still tests-in-happy-dom only — no real-browser resize verification yet.
Noticed in passing, not fixed
render.tsbuilds the editor's mode class with a baretoLowerCase(), producingmode-read_only, whilestatus-line.tsnormalises tomode-read-only. Separately,theme.cssstyles.widget-editor-mode.*, and nothing in the client ever emits that class — the editor root iswidget-editor mode-*. So those rules are dead either way. Cosmetic, out of scope here.