Skip to content

Commit

Permalink
Input device capabilities api (#30656)
Browse files Browse the repository at this point in the history
* add groupdata

* update apiref

* add Extensions to other interfaces section

* style pretty

* add UIEvent.sourceCapabilities

* fix macros

* Update files/jsondata/GroupData.json

* fix macros

* style pretty
  • Loading branch information
skyclouds2001 authored Dec 2, 2023
1 parent 8fd2ee7 commit 8cac4a3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ status:
browser-compat: api.InputDeviceCapabilities.firesTouchEvents
---

{{APIRef}}{{SeeCompatTable}}
{{APIRef("Input Device Capabilities API")}}{{SeeCompatTable}}

The **`InputDeviceCapabilities.firesTouchEvents`** read-only
property returns a boolean value that indicates whether the device dispatches
touch events.
The **`firesTouchEvents`** read-only property of the {{domxref("InputDeviceCapabilities")}} interface returns a boolean value that indicates whether the device dispatches touch events.

You can use this property to detect mouse events that represent an action that may
already have been handled by touch event handlers. This doesn't necessarily mean the
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/inputdevicecapabilities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ status:
browser-compat: api.InputDeviceCapabilities
---

{{APIRef("InputDeviceCapabilities API")}}{{SeeCompatTable}}
{{APIRef("Input Device Capabilities API")}}{{SeeCompatTable}}

The **`InputDeviceCapabilities`** interface of the [Input Device Capabilities API](/en-US/docs/Web/API/InputDeviceCapabilities_API) provides information about the physical device or a group of related devices responsible for generating input events. Events caused by the same physical input device get the same instance of this object, but the converse isn't true. For example, two mice with the same capabilities in a system may appear as a single `InputDeviceCapabilities` instance.
The **`InputDeviceCapabilities`** interface of the {{domxref("InputDeviceCapabilities API", "Input Device Capabilities API", "", "nocode")}} provides information about the physical device or a group of related devices responsible for generating input events. Events caused by the same physical input device get the same instance of this object, but the converse isn't true. For example, two mice with the same capabilities in a system may appear as a single `InputDeviceCapabilities` instance.

In some instances, `InputDeviceCapabilities` represents the capabilities of logical devices rather than physical devices. This allows, for example, touchscreen keyboards and physical keyboards to be represented the same way when they produce the same input.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ status:
browser-compat: api.InputDeviceCapabilities.InputDeviceCapabilities
---

{{SeeCompatTable}}
{{APIRef("Input Device Capabilities API")}}{{SeeCompatTable}}

The `InputDeviceCapabilities()` constructor creates a new
{{domxref("InputDeviceCapabilities")}} object provides information about the physical
Expand Down
9 changes: 7 additions & 2 deletions files/en-us/web/api/inputdevicecapabilities_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ status:
browser-compat: api.InputDeviceCapabilities
---

{{DefaultAPISidebar("InputDeviceCapabilities API")}}{{SeeCompatTable}}
{{DefaultAPISidebar("Input Device Capabilities API")}}{{SeeCompatTable}}

The InputDeviceCapabilities API provides details about the underlying sources of input events. The API attempts to describe how the device behaves rather than what it is. For example, the first version of the API indicates whether a device fires touch events rather than whether it is a touch screen.

Expand All @@ -26,9 +26,14 @@ myButton.addEventListener("mousedown", (e) => {

## Interfaces

- {{DOMxRef("InputDeviceCapabilities")}} {{Experimental_Inline}}
- {{domxref("InputDeviceCapabilities")}} {{Experimental_Inline}}
- : Provides logical information about an input device.

## Extensions to other interfaces

- {{domxref("UIEvent.sourceCapabilities")}} {{Experimental_Inline}} {{ReadOnlyInline}}
- : Returns an instance of the `InputDeviceCapabilities` interface, which provides information about the physical device responsible for generating a touch event.

## Specifications

{{Specifications}}
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/uievent/sourcecapabilities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ status:
browser-compat: api.UIEvent.sourceCapabilities
---

{{APIRef("UI Events")}}{{SeeCompatTable}}
{{APIRef("Input Device Capabilities API")}}{{SeeCompatTable}}

The **`UIEvent.sourceCapabilities`** read-only property returns
The **`sourceCapabilities`** read-only property of the {{domxref("UIEvent")}} interface returns
an instance of the {{domxref('InputDeviceCapabilities')}} interface which provides
information about the physical device responsible for generating a touch event. If no
input device was responsible for the event, it returns `null`.
Expand Down
8 changes: 8 additions & 0 deletions files/jsondata/GroupData.json
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,14 @@
"properties": ["Navigator.ink"],
"events": []
},
"Input Device Capabilities API": {
"overview": ["InputDeviceCapabilities API"],
"guides": [],
"interfaces": ["InputDeviceCapabilities"],
"methods": [],
"properties": ["UIEvent.sourceCapabilities"],
"events": []
},
"Insertable Streams for MediaStreamTrack API": {
"overview": ["Insertable Streams for MediaStreamTrack API"],
"guides": [],
Expand Down

0 comments on commit 8cac4a3

Please sign in to comment.