Files
inline-comment/.docs/decisions/0003-keydown-as-trigger.md
Oliver_Herb 9053327486 Inline Comment 0.2.0 - initial public release
Thunderbird/Betterbird add-on (Manifest V3): typing inside a quote splits
the quote and inserts your own text with a marker such as [OH]:.

- English and German user interface
- Licensed under the Mozilla Public License 2.0
- English documentation, JSDoc lint gate, 87 tests (node:test + jsdom)
2026-11-24 12:07:09 +01:00

1.1 KiB
Raw Permalink Blame History

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.