# 0003 – keydown as trigger, beforeinput as fallback **Date:** 2026-11-24 · **Status:** accepted ## Context The quote should only be split on actual text input, not on clicking or selecting. Candidates are `keydown` and `beforeinput`. During `beforeinput` an editor action is already running; further `execCommand` calls inside it are not reliable in Gecko. ## Decision - `keydown`: printable keys without Ctrl/Alt/Cmd (AltGr allowed, so that `@`, `€`, `{` work). Intercept, then split and insert immediately. - `beforeinput` with `inputType = "insertText"`: only for input without a matching key press (on-screen keyboard, emoji picker). Intercept and insert in the next task; characters arriving in between are collected in `pendingText`. ## Consequences - Shortcuts such as Ctrl+C and Ctrl+A, named keys such as the arrow keys, Delete, Backspace and Enter, and clicks never start a comment; the editor handles them as usual. - Dead keys (`^`, `´`) deliver the finished character with the second key press; IME input (`compositionstart`) is not handled.