Warning:
This wiki has been archived and is now read-only.
Key event order
From WEBAPPS
WebApps ⇨ DOM3Events ⇨ Key event order
Contents
Proposed Order for Key-Related Events
This is the proposed sequence of the firing of key-related events
- diagram (SVG)
- Pseudo-regular-expression syntax:
(keydown
-> (keypress
->textInput
?)?) ->keylongpress
? -> (keydown
-> (keypress
->textInput
?)?)+ ->keyup
->textInput
?
-
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, seetextInput
event) -
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
repeat
property) -
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)
textInput
event
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 keydown/keypress
.
repeat property
repeat
property 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 therepeat
property 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]