+
Skip to content

Conversation

codebytere
Copy link
Member

Description of Change

Closes #43713

Improve spec adherence in the Web Hid API by properly supporting the collections instance properties. This allows developers to filter and make permissioning decisions based on for example the usagePage and usage properties of a device in select-hid-device and permission handlers.

Checklist

Release Notes

Notes: Added support for HIDDevice.collections.

@codebytere codebytere requested review from jkleinsc and a team June 6, 2025 09:01
@codebytere codebytere added semver/minor backwards-compatible functionality target/36-x-y PR should also be added to the "36-x-y" branch. target/37-x-y PR should also be added to the "37-x-y" branch. labels Jun 6, 2025
@codebytere codebytere force-pushed the support-hiddevice-collections branch from cdba608 to 46ee1b2 Compare June 6, 2025 09:01
@codebytere codebytere force-pushed the support-hiddevice-collections branch from 46ee1b2 to 2ec929f Compare June 6, 2025 11:24
* `productId` Integer - The USB product ID.
* `serialNumber` string (optional) - The USB device serial number.
* `guid` string (optional) - Unique identifier for the HID interface. A device may have multiple HID interfaces.
* `collections` Object[] - an array of report formats. See [Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/collections) for more.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this feature isn't a web standard and is only implemented in Chrome, is there a chance that the spec changes? I see on https://wicg.github.io/webhid/ the following paragraph:

This specification was published by the Web Platform Incubator Community Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply. Learn more about W3C Community and Business Groups.

Would it be beneficial to us to mark it as experimental?

Copy link
Member Author

@codebytere codebytere Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erickzhao that text applies to all WebHID, not collections - imo it'd be a bit strange to mark this as experimental when no other part of WebHID is in our docs.

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
Copy link
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

Copy link
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@jkleinsc jkleinsc merged commit 2ad762e into main Jun 16, 2025
59 checks passed
@jkleinsc jkleinsc deleted the support-hiddevice-collections branch June 16, 2025 19:56
@release-clerk
Copy link

release-clerk bot commented Jun 16, 2025

Release Notes Persisted

Added support for HIDDevice.collections.

@trop
Copy link
Contributor

trop bot commented Jun 16, 2025

I have automatically backported this PR to "37-x-y", please check out #47483

@trop trop bot added in-flight/37-x-y and removed target/37-x-y PR should also be added to the "37-x-y" branch. labels Jun 16, 2025
@trop
Copy link
Contributor

trop bot commented Jun 16, 2025

I have automatically backported this PR to "36-x-y", please check out #47484

@trop trop bot added in-flight/36-x-y and removed target/36-x-y PR should also be added to the "36-x-y" branch. labels Jun 16, 2025
@trop trop bot added merged/36-x-y PR was merged to the "36-x-y" branch. merged/37-x-y PR was merged to the "37-x-y" branch. and removed in-flight/36-x-y in-flight/37-x-y labels Jun 18, 2025
kigh-ota pushed a commit to kigh-ota/electron that referenced this pull request Sep 30, 2025
* feat: support HIDDevice.collections

* Update docs/api/structures/hid-device.md

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

---------

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ merged/36-x-y PR was merged to the "36-x-y" branch. merged/37-x-y PR was merged to the "37-x-y" branch. semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: HIDDevice Object should contain usagePage and usage properties
3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载