Web/API/UIEvent

From Get docs


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.cancelBubble ' '
Is a Boolean indicating whether the bubbling of the event has been canceled or not.
UIEvent.detailRead only
Returns a long with details about the event, depending on the event type.
UIEvent.isChar ' Read only
Returns a Boolean indicating whether the event produced a key character or not.
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.pageX ' Read only
Returns the horizontal coordinate of the event relative to the whole document.
UIEvent.pageY ' Read only
Returns the vertical coordinate of the event relative to the whole document.
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 Status Comment
InputDeviceCapabilities Draft Added sourceCapabilities property.
UI Events Working Draft Extend DOM3
Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'UIEvent' in that specification. Obsolete Added the UIEvent() constructor, deprecated the initUIEvent() method and changed the type of view from AbstractView to WindowProxy.
Document Object Model (DOM) Level 2 Events SpecificationThe definition of 'UIEvent' in that specification. Obsolete Initial definition

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
UIEvent Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

UIEvent() constructor Chrome

Full support Yes

Edge

Full support ≤18

Firefox

Full support 11

IE

?

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 14

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

cancelBubble

Deprecated'Non-standard'

Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

detail Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE Partial support 9

Notes'

Partial support 9

Notes'

Notes' 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.

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

initUIEvent

Deprecated'Non-standard'

Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

?

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

isChar

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox No support ? — 55

Notes'

No support ? — 55

Notes'

Notes' The isChar property has never been supported by any browser but Firefox, and even on Firefox it's never worked except on Mac OSX. For that reason, it's been removed in Firefox 55 to align with other browsers.

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android No support ? — 55

Notes'

No support ? — 55

Notes'

Notes' The isChar property has never been supported by any browser but Firefox, and even on Firefox it's never worked except on Mac OSX. For that reason, it's been removed in Firefox 55 to align with other browsers.

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

layerX

Non-standard'

Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

Full support 9

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

layerY

Non-standard'

Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

Full support 9

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

pageX

Deprecated'Non-standard'

Chrome No support ? — 44

Notes'

No support ? — 44

Notes'

Notes' Replaced by MouseEvent.pageX in version 45.

Edge

Full support 12

Firefox

?

IE

Full support 9

Opera

?

Safari

?

WebView Android No support ? — 44

Notes'

No support ? — 44

Notes'

Notes' Replaced by MouseEvent.pageX in version 45.

Chrome Android No support ? — 44

Notes'

No support ? — 44

Notes'

Notes' Replaced by MouseEvent.pageX in version 45.

Firefox Android

?

Opera Android

?

Safari iOS

?

Samsung Internet Android No support ? — 4.0

Notes'

No support ? — 4.0

Notes'

Notes' Replaced by MouseEvent.pageX in Samsung Internet 5.0.

pageY

Deprecated'Non-standard'

Chrome No support ? — 44

Notes'

No support ? — 44

Notes'

Notes' Replaced by MouseEvent.pageY in version 45.

Edge

Full support 12

Firefox

?

IE

Full support 9

Opera

?

Safari

?

WebView Android No support ? — 44

Notes'

No support ? — 44

Notes'

Notes' Replaced by MouseEvent.pageY in version 45.

Chrome Android No support ? — 44

Notes'

No support ? — 44

Notes'

Notes' Replaced by MouseEvent.pageY in version 45.

Firefox Android

?

Opera Android

?

Safari iOS

?

Samsung Internet Android No support ? — 4.0

Notes'

No support ? — 4.0

Notes'

Notes' Replaced by MouseEvent.pageY in Samsung Internet 5.0.

sourceCapabilities

Experimental'

Chrome

Full support 47

Edge

Full support ≤79

Firefox

?

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support 47

Chrome Android

Full support 47

Firefox Android

?

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support 5.0

view Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

Full support 9

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

which Chrome

Full support Yes

Edge

Full support ≤79

Firefox

Full support Yes

IE

No support No

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
Partial support  
Partial support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.'
Deprecated. Not for use in new websites.
See implementation notes.'
See implementation notes.


See also

  • [[../../../Learn/JavaScript/Building_blocks/Events|Introduction to events]]
  • Event

UIEvent by Mozilla Contributors is licensed under CC-BY-SA 2.5.