Skip to content

tools: standalone CM iOS autocaps / pendingIOSKey repro#304

Open
Stvad wants to merge 2 commits into
masterfrom
claude/competent-proskuriakova-0f0c7c
Open

tools: standalone CM iOS autocaps / pendingIOSKey repro#304
Stvad wants to merge 2 commits into
masterfrom
claude/competent-proskuriakova-0f0c7c

Conversation

@Stvad

@Stvad Stvad commented Jul 3, 2026

Copy link
Copy Markdown
Owner

What

A minimal, standalone CodeMirror 6 page (no knowledge-medium app code) to determine, on a real iOS device, whether the WebKit soft-keyboard state bug behind CodeMirror's pendingIOSKey deferral is still present.

Original issue being tested

The root issue is codemirror/dev #165: when JavaScript moves the browser's DOM Selection, iOS Safari can keep the soft keyboard's autocapitalize/autocomplete state from the old caret position.

That is the behavior CodeMirror works around with pendingIOSKey / flushIOSKey: for iOS Enter/Backspace/Delete, CM lets the native key action update the keyboard state first, then retroactively runs the keybinding and resets the DOM. The later codemirror/dev #433 thread helped exercise Enter/Backspace symptoms and follow-up regressions, but it is not the original bug.

The repro

Two CodeMirror editors, seeded identically per scenario:

  • CONTROL — bare EditorView; on iOS its keys go through CM's real pendingIOSKey native-passthrough path.
  • TEST — same editor plus capture-phase interception. For Enter/Backspace/Delete it prevents the native edit, applies the edit via a CM transaction, and explicitly calls Selection.collapse(...) at the new cursor position so the trace proves the DOM selection moved by script.

The default Script move scenario targets #165 directly without involving a key workaround:

  1. In CONTROL, manually tap the sentence-start position and type q for the native baseline.
  2. In TEST, tap a lowercase old position, tap Move TEST caret by script, then type q.
  3. Uppercase means the keyboard state updated after the JS DOM-selection move; lowercase means it stayed on the old position's state.

The Enter and Backspace scenarios are the pendingIOSKey soft-keyboard cases that matter to our app. Delete is a hardware-keyboard sanity probe only.

Self-contained

Vendors the exact @codemirror/view@6.43.0 + @codemirror/state@6.6.0 ESM out of node_modules behind an importmap (sync-vendor.mjs; vendor/ gitignored), served by a tiny dep-free static server for the ios-device-debug tunnel loop. See tools/ios-autocaps-repro/README.md.

Status

Repro built and smoke-tested on desktop/headless Chromium; on-device run + verdict pending because native soft-keyboard behavior must be tested by physically typing on an iOS device.

🤖 Generated with Claude Code

A minimal, app-free CodeMirror 6 page to test on a real iOS device whether the
WebKit soft-keyboard autocapitalization bug behind CM's pendingIOSKey deferral
(codemirror/dev #165, #433) is still present.

Two editors: a CONTROL using CM's real pendingIOSKey native-passthrough, and a
TEST that preventDefaults Enter/Backspace/Delete + applies the edit via a CM
transaction (programmatic DOM-selection move = the exact #165 condition). The
inserted character's case is the objective verdict.

Self-contained: vendors the exact @codemirror/view@6.43.0 + @codemirror/state
ESM out of node_modules behind an importmap (sync-vendor.mjs; vendor/ gitignored),
served by a tiny dep-free static server for the ios-device-debug tunnel loop.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Stvad.github.io/knowledge-medium/pr-preview/pr-304/

Built to branch gh-pages at 2026-07-05 08:15 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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