Mouse, Touch or Keyboard
Whatcha usin?
Sometimes it's really helpful to know whether the user is interacting with a mouse, touchscreen or keyboard.
Roll your mouse over the page, tab through it or tap/drag/scroll...
This can be pretty useful for fine-tuning accessibility presentation and managing things like hover state delays and other weirdness on touchscreens.
The goal is not to find what the users device is capable of but what the user is actually using at the time (Right now I am using a mouse on a touchscreen device myself).
To do that, we need to react to something the user does. Including switching from one interaction method to another.
Currently I'm using the touchstart, keydown and pointermove events along with the pointerType property of pointermove. So far this seems reliable across devices that trigger other "mouse" events on touch.