From 8cac4a3fed6a702840efd2deda67a922120732d0 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:34:08 +0800 Subject: [PATCH] Input device capabilities api (#30656) * 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 --- .../inputdevicecapabilities/firestouchevents/index.md | 6 ++---- files/en-us/web/api/inputdevicecapabilities/index.md | 4 ++-- .../inputdevicecapabilities/index.md | 2 +- files/en-us/web/api/inputdevicecapabilities_api/index.md | 9 +++++++-- files/en-us/web/api/uievent/sourcecapabilities/index.md | 4 ++-- files/jsondata/GroupData.json | 8 ++++++++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/files/en-us/web/api/inputdevicecapabilities/firestouchevents/index.md b/files/en-us/web/api/inputdevicecapabilities/firestouchevents/index.md index 9a198cd06062057..c73d17bad7f7417 100644 --- a/files/en-us/web/api/inputdevicecapabilities/firestouchevents/index.md +++ b/files/en-us/web/api/inputdevicecapabilities/firestouchevents/index.md @@ -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 diff --git a/files/en-us/web/api/inputdevicecapabilities/index.md b/files/en-us/web/api/inputdevicecapabilities/index.md index 45de8276182d089..da2f9be2c16465c 100644 --- a/files/en-us/web/api/inputdevicecapabilities/index.md +++ b/files/en-us/web/api/inputdevicecapabilities/index.md @@ -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. diff --git a/files/en-us/web/api/inputdevicecapabilities/inputdevicecapabilities/index.md b/files/en-us/web/api/inputdevicecapabilities/inputdevicecapabilities/index.md index aa45d26be29d463..f83c429c14c670e 100644 --- a/files/en-us/web/api/inputdevicecapabilities/inputdevicecapabilities/index.md +++ b/files/en-us/web/api/inputdevicecapabilities/inputdevicecapabilities/index.md @@ -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 diff --git a/files/en-us/web/api/inputdevicecapabilities_api/index.md b/files/en-us/web/api/inputdevicecapabilities_api/index.md index a10d702ad22f5eb..8e6596d1de5e114 100644 --- a/files/en-us/web/api/inputdevicecapabilities_api/index.md +++ b/files/en-us/web/api/inputdevicecapabilities_api/index.md @@ -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. @@ -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}} diff --git a/files/en-us/web/api/uievent/sourcecapabilities/index.md b/files/en-us/web/api/uievent/sourcecapabilities/index.md index a656bbc9ee9a31f..8a8063ffafde527 100644 --- a/files/en-us/web/api/uievent/sourcecapabilities/index.md +++ b/files/en-us/web/api/uievent/sourcecapabilities/index.md @@ -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`. diff --git a/files/jsondata/GroupData.json b/files/jsondata/GroupData.json index d03c03864818589..2f2f8ca29f47cb7 100644 --- a/files/jsondata/GroupData.json +++ b/files/jsondata/GroupData.json @@ -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": [],