do not test for hover when checking touch device.

This commit is contained in:
Miroslav Šedivý 2025-04-26 11:42:02 +02:00
parent 85bfaf31c3
commit 540b2e0a88

View file

@ -367,12 +367,11 @@
get is_touch_device() {
return (
// check if the device has a touch screen
// detect if the device has touch support
('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
// we also check if the device has a pointer
!window.matchMedia('(pointer:fine)').matches &&
// and is capable of hover, then it probably has a mouse
!window.matchMedia('(hover:hover)').matches
// the primary input mechanism includes a pointing device of
// limited accuracy, such as a finger on a touchscreen.
window.matchMedia('(pointer: coarse)').matches
)
}