Hallvord R. M. Steen wrote: > RELATIONSHIP BETWEEN EVENT TYPES
There are two types of key events: * Hardware reference events. The keydown and keyup events report that a key was pressed down and released. These events include keyboard reference information but do not confirm what character(s) if any will be inserted. Keyboard reference codes are hardware-, software-, locale- and system-dependent, but implementations should map as many keys as possible to virtual key codes as defined below. * Text insertion events. The keypress and textInput events include complete information about the character the input is generating, if any, taking into account shift states, previous dead keys and other contextual information required to decide what character will be inserted by a key press.
But does insertion mean anything visible. Or is it more like "pass a command to the application". So if focus is for example on <input> and the character is visible, let's say an 'A', the text is added to the <input>. But if 'ESC' is pressed, keypress is dispatched but nothing gets updated. Or if 'ESC' is special, what about 'Backspace'?
The textInput event also shows what character(s) were generated by an active input method editor.
textInput should be dispatched also when IME isn't active, right?
The keypress event MUST NOT fire when an IME is processing the input for conversion.
Why not? IME could emulate normal keydown/keypress/keyup. -Olli