Key event order
Proposed Order for Key-Related Events
This is the proposed sequence of the firing of key-related events
- diagram (SVG)
- Pseudo-regular-expression syntax:
keylongpress? -> (
keydown: key is pressed
keypress: key is pressed (optional)
textInput: if the key pressed represents a character, the textInput event is fired just after keydown/keypress, under some systems and circumstances (optional, see
keylongpress: the user keeps the button depressed for a prolonged time, triggering a special event on some systems (particularly mobile devices) (optional)
- repeat sequence: if the user keeps the button depressed, the keydown/keypress/textInput event set is fired multiple times on some systems (optional, see
keyup: the key is released
textInput: if the key pressed represents a character, the textInput event is fired just after keydown/keypress, under some systems and circumstances (optional)
Some systems fire the
textInput event after
keydown/keypress, while others fire it after
keyup. If the implementation has the option, it should be fired just after
repeatproperty readonly attribute boolean repeat; ctrlKey of type boolean, readonly true iff a key is pressed for a period of time determined by the system, and multiple events of the same type are fired repeatedly. There is often a pause between the initial firing of the keydown/keypress/textInput event and the subsequent firings, with a more rapid rate for subsequent events. When the keyup event is fired, the repetition stops, and the
repeatproperty is false.
The repeat property originated in Internet Explorer.
Relationship to IME
Interaction with Input Method Editors is to be defined.
keydown -> keyup -> [IME/textInput]