UIEvent

The UIEvent interface represents simple user interface events.

UIEvent derives from Event. Although the UIEvent.initUIEvent() method is kept for backward compatibility, you should create a UIEvent object using the UIEvent() constructor.

Several interfaces are direct or indirect descendants of this one: MouseEvent, TouchEvent, FocusEvent, KeyboardEvent, WheelEvent, InputEvent, and CompositionEvent.

Constructors

UIEvent()

Creates a UIEvent object.

Properties

This interface also inherits properties of its parent, Event.

UIEvent.detailRead only

Returns a long with details about the event, depending on the event type.

UIEvent.layerX Read only

Returns the horizontal coordinate of the event relative to the current layer.

UIEvent.layerY Read only

Returns the vertical coordinate of the event relative to the current layer.

UIEvent.sourceCapabilities Read only

Returns an instance of the InputDeviceCapabilities interface, which provides information about the physical device responsible for generating a touch event.

UIEvent.viewRead only

Returns a WindowProxy that contains the view that generated the event.

UIEvent.which Read only

Returns the numeric keyCode of the key pressed, or the character code (charCode) for an alphanumeric key pressed.

Methods

This interface also inherits methods of its parent, Event.

UIEvent.initUIEvent()

Initializes a UIEvent object. If the event has already being dispatched, this method does nothing.

Specifications

Specification
UI Events
# idl-uievent

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
UIEvent
1
12
1
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
UIEvent
26
12
11
No
15
7
1
26
14
14
7
1.0
detail
1
12
1
9
Always 0 on click and dblclick events. On mousedown and mouseup events, the count is not unique to the element, but is rather the global click count for the current document -- even across refreshes.
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
initUIEvent
1
12
1
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
layerX
1-45
12
1
9
15-32
≤4
≤37-45
18-45
4
14-32
≤3
1.0-5.0
layerY
1-45
12
1
9
15-32
≤4
≤37-45
18-45
4
14-32
≤3
1.0-5.0
sourceCapabilities
47
79
No
No
34
No
47
47
No
34
No
5.0
view
1
12
1
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
which
1
79
12-79
Only supported for KeyboardEvent and MouseEvent, not all UIEvent objects.
1
On mousemove events, the which property is incorrectly always set to 1.
9
Only supported for KeyboardEvent and MouseEvent, not all UIEvent objects.
15
≤12.1-15
Only supported for KeyboardEvent and MouseEvent, not all UIEvent objects.
≤4
≤37
18
4
On mousemove events, the which property is incorrectly always set to 1.
14
≤12.1-14
Only supported for KeyboardEvent and MouseEvent, not all UIEvent objects.
≤3
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent