Skip to content

fix: prevent IME composition line break in checkbox list items#95

Merged
j4rviscmd merged 2 commits intomainfrom
fix/ime-checkbox-fix
Mar 28, 2026
Merged

fix: prevent IME composition line break in checkbox list items#95
j4rviscmd merged 2 commits intomainfrom
fix/ime-checkbox-fix

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Extend imeCompositionGuard to handle checkListItem blocks where contenteditable="false" checkbox wrapper confuses ProseMirror's DOM-to-model position mapping during IME composition
  • Add document snapshot restore mechanism: save pre-composition state and restore after flush, inserting only committed text via queueMicrotask (before paint, no visual glitch)
  • Add insertParagraph to blocked input types alongside insertLineBreak
  • Allow restore transactions through filterTransaction via meta tag

Root cause

For checkListItem blocks, ProseMirror's composition flush produces incorrect transactions because the contenteditable="false" wrapper around the checkbox confuses DOM-to-model position mapping. This results in:

  • Duplicate blocks being created
  • Text being appended to the parent block
  • Unwanted line breaks within the block

Test plan

  • Empty checkbox in child list → IME "あか" → Enter → "赤" (no line break, no duplicate)
  • Regular bullet list IME composition Enter (regression)
  • IME ON normal text input works correctly (regression)
  • Checkbox with existing text → IME composition works (regression)

🤖 Generated with Claude Code

j4rviscmd and others added 2 commits March 28, 2026 11:19
Extend imeCompositionGuard to handle checkListItem blocks where
contenteditable="false" checkbox wrapper confuses ProseMirror's
DOM-to-model position mapping during composition.

Key changes:
- Add document snapshot restore mechanism: save pre-composition state
  and restore after flush, inserting only committed text via
  queueMicrotask (before paint, no visual glitch)
- Add insertParagraph to blocked input types alongside insertLineBreak
- Allow restore transactions through filterTransaction via meta tag
- Improve type safety (replace any with proper ProseMirror types)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@j4rviscmd j4rviscmd added the bug Something isn't working label Mar 28, 2026
@j4rviscmd j4rviscmd merged commit 6143abb into main Mar 28, 2026
2 checks passed
@j4rviscmd j4rviscmd deleted the fix/ime-checkbox-fix branch March 28, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant