← Back to release summary

WebHID exclusionFilters option in requestDevice()

Category
Device
Type
Chromium catches up
Status
Enabled by default (Chrome 102)
Intent stage
Shipped

Summary

The "exclusionFilters" option in navigator.hid.requestDevice() allows web developers to exclude some devices from the browser picker. It can be used to exclude devices that are known to be malfunctioning.

Motivation

Allowing web developers, through the "exclusionFilters" option, to exclude directly from the browser picker some devices that are known to not function in a way that suits the site will improve user experience. Without it, web developers let users pick a device, then have to check against a custom JavaScript helper function (like deviceIsBlocklisted()) whether device is known to be malfunctioning and if that’s the case alert users the device they’ve picked is not suitable, resulting in a poor user experience.

Standards & signals

Explainers: https://github.com/WICG/webhid/blob/main/EXPLAINER.md

View on chromestatus.com