client-hints-infrastructure icon indicating copy to clipboard operation
client-hints-infrastructure copied to clipboard

Input Modality as a UACH

Open elijahsoria opened this issue 3 years ago • 4 comments

It would be great to have input modality (mouse, touch, etc) be passed on each request by Chrome as a User Agent Client Hint (UACH). It would help in determining how people use sites and allows for different UIs and the like when users are using different input modalities.

Any interest in creating this as a UACH?

elijahsoria avatar Aug 20 '21 16:08 elijahsoria

In CSS, you have pointer or any-pointer (the latter can be used as touch screen proxy if the value is coarse). You can query it from JavaScript like so:

window.matchMedia('(any-pointer: coarse)').matches

In theory, this could be exposed in the form of Sec-CH-Any-Pointer.

tomayac avatar Aug 20 '21 16:08 tomayac

I think a collection of client hints to capture input modality, as well as other form-factor / device characteristics could be interesting (e.g., has a screen, or doesn't). Input modality could perhaps capture VR as well?

miketaylr avatar Aug 20 '21 16:08 miketaylr

I think it's a good idea as a high entropy hint. I do wonder about ossification (I actually think we need some more specific instructions on client hints, but maybe that's for another issue)

Right now, I believe there's only three method available that make a qualifying event: keyboard, mouse, and touch. Those'd probably be a good place to start, and maybe if there's ever any more input events we can add them.

amtunlimited avatar Aug 23 '21 14:08 amtunlimited

(I just remembered there's the Gamepad API as well)

amtunlimited avatar Aug 31 '21 13:08 amtunlimited