3 ms·
Maybe it's just me, but it seems like a huge waste of time (or to be on a more positive note - potential). Just the first example "Device type in JS". "A coar
by zeroq 1mo ago
Maybe it's just me, but it seems like a huge waste of time (or to be on a more positive note - potential).
Just the first example "Device type in JS".
"A coarse pointer does not mean “mobile”, and a fine pointer does not guarantee “desktop”. Ask the browser about input capabilities instead of guessing the device from its user agent."
const input = {
finePointer: matchMedia('(any-pointer: fine)').matches,
coarsePointer: matchMedia('(any-pointer: coarse)').matches,
canHover: matchMedia('(any-hover: hover)').matches,
};
So it doesn't tell me how to identify device type. It doesn't even run the code so I could quickly compare results between my mobile and desktop devices to establish a baseline.
- wonnage 1mo agoIt has all the hallmarks of just telling an agent to scrape MDN and make a website
- marcomezzavilla 1mo agoIt wasn’t, but I’d be curious to know what specifically gave you that impression.
- marcomezzavilla 1mo agoYou’re right: it doesn’t identify the device type, so the title is misleading. The intended point is that device type is often the wrong thing to detect: a touchscreen laptop may expose both coarse and fine pointers, while a tablet may be connected to a mouse or trackpad. The snippet detects available input capabilities instead, which is usually what the interface should respond to. I wasn’t particularly careful with the titles, but this one should be "Detect input capabilities". Thanks for the heads-up!
- AlienRobot 1mo agoThe conclusion is wrong. The point of using these media queries is that: 1) You can only use tiny buttons with precise pointers. 2) You can only use hover popups with pointers that can actually hover. In practice, much of this is too much work and everyone just designs for touchscreens instead. It's rare to find a website that even bothers with using title="" for tooltips because smartphones are a disaster of UI and lack tooltips.