Jump to: navigation, search

WebAppsDOM3Events ⇨ Longpress

There are two ways that longpress might be addressed in DOM 3 Events: as its own event; or as a property on other key events, in the same manner as repeat.


In Key event order, the longpress event is represented as its own event after a sufficient sustained pressing of the key.


From Robin Berjon:

It is often the case that a user can hold a key down for a longer  
period of time in order to modify the behaviour of a given key. This  
modifier is called "LongPress" and can therefore be queried using  
getModifierState("LongPress"). Note that depending on the device this  
information may be available when the keyup event is dispatched but  
not when the keydown event is.


The evidence seems to favor the notion of longpress as a property. More testing is needed.

longpress is a property on a key event, with boolean value that resolves to true iff the user keeps the key depressed for a sufficient amount of time.

  • May be system dependent.
  • Needs testing to see if longpress is of limited duration, or if it is true the entire time the key is pressed.
  • Needs testing to see if longpress is triggered at a specific time, and if it is before or after repeat.

See also repeat.