Key event order

From WEBAPPS
Revision as of 18:15, 26 March 2008 by Mcaceres (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

WebAppsDOM3Events ⇨ Key event order

Proposed Order for Key-Related Events

This is the proposed sequence of the firing of key-related events

(keydown -> (keypress -> textInput?)?) -> keylongpress? -> (keydown -> (keypress -> textInput?)?)+ -> keyup -> textInput?
  1. keydown: key is pressed
  2. keypress: key is pressed (optional)
  3. textInput: if the key pressed represents a character, the textInput event is fired just after keydown/keypress, under some systems and circumstances (optional, see textInput event)
  4. keylongpress: the user keeps the button depressed for a prolonged time, triggering a special event on some systems (particularly mobile devices) (optional)
  5. 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)
  6. keyup: the key is released
  7. 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 the 
repeat 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]

References