Skip to content

fix: spellcheck works in the Android app - #519

Merged
ScottKirvan merged 3 commits into
mainfrom
fix/android-spellcheck-without-editcontext
Oct 16, 2026
Merged

ScottKirvan merged 3 commits into
mainfrom
fix/android-spellcheck-without-editcontext

Conversation

@ScottKirvan

Copy link
Copy Markdown
Owner

Description

Makes the EditContext experiment permanent, now that Scott has typed with it for several days without problems.

Spellcheck in the Android app. On Android, CodeMirror types through the EditContext API, which bypasses the WebView's spellcheck, so misspellings were never underlined there (#504 enabled spellcheck, but Android never used it). The editor now uses the WebView's own editing on Android (EditorView.EDIT_CONTEXT = false, set in project/src/main.ts before the view is created). Scott confirmed on device: underlines and replacement suggestions work. Desktop and web are unaffected; they never used EditContext. Sentence auto-capitalisation doesn't work in either mode, and Scott is fine with that.

Backspace safeguard. In this mode the Android keyboard deletes inside the page itself, and CodeMirror tags that as typing (input.type), not Backspace. So a drawn checkbox, bullet, number or quote marker was removed in one go, breaking the "Backspace deletes one character at a time" rule. New project/src/markerBackspaceGuard.ts catches a single deletion that ends at the cursor inside a line's list, task or quote marker, and turns it into a one-character delete. It leaves selections, cut, undo and programmatic changes alone. The one case it can't tell apart: a keyboard "delete word" that lands entirely inside a marker is cut to one character. Heading # markers are left as they are, per Scott.

CLAUDE.md gains an "Android text input" section: how input works on Android now, and the kinds of bugs this mode can introduce, to check first when Android typing misbehaves.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

On-device testing

Already tested by Scott for several days on the experiment build (branch experiment/android-without-editcontext, the same two code changes on main): spellcheck underlines and suggestions work, Backspace into a checkbox deletes one character at a time, and typing has felt normal.

How Has This Been Tested?

  • markerBackspaceGuard.test.ts: 6 of 13 failed before the safeguard, all pass after. listBackspace.e2e.ts gains a DOM-delete step that failed before (got "") and passes after. markdownBackspace.test.ts, enterListIndent, listReveal, undoRedo and tsc -b passed on the experiment branch.
  • Several days of real use on Android (Scott).
  • Full suite left to CI.

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

On Android, CodeMirror types through the EditContext API, which bypasses the WebView's spellcheck, so misspellings were never underlined there. The editor now uses the WebView's own editing on Android (EditorView.EDIT_CONTEXT = false). Desktop and web are unaffected; they never used EditContext.
… at a time

Without EditContext the browser deletes in the DOM itself, and a drawn marker (a replaced range) goes in one change that CodeMirror reads back as input.type, bypassing the keymap. A transaction filter narrows any backward deletion that removes more than one character of a line's list, task or quote marker prefix, ending at the caret, to the single character before the caret.
Android now types through the WebView's own editing instead of EditContext. The new section says so and lists the kinds of bugs that mode tends to cause, so future work checks for them first.
@ScottKirvan
ScottKirvan merged commit dcd2394 into main Oct 16, 2026
4 checks passed
@ScottKirvan
ScottKirvan deleted the fix/android-spellcheck-without-editcontext branch October 16, 2026 16:00
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.

1 participant