Can I ascertain if something is a touch device

One tricky thing to consider is laptops with touch screens. In that case, the primary interaction tends to be via a mouse… even though the device technically has a touch screen. That has caused us some headaches recently with reactions :sweat_smile:

But to answer your specific question: I think CSS media queries are the way to go. We have hover, pointer, any-hover and any-pointer.

And then you can run those CSS media queries from JS using window.matchMedia like this:

4 Likes