We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
capabilities.touch
1 parent b2d0ec0 commit ad5e02aCopy full SHA for ad5e02a
app/assets/javascripts/discourse/app/services/capabilities.js
@@ -14,9 +14,9 @@ const breakpointQueries = {
14
"2xl": new TrackedMediaQuery("(min-width: 96rem)"),
15
};
16
17
-class Capabilities {
18
- touch = navigator.maxTouchPoints > 1 || "ontouchstart" in window;
+const anyPointerCourseQuery = new TrackedMediaQuery("(any-pointer: coarse)");
19
+class Capabilities {
20
isAndroid = ua.includes("Android");
21
isWinphone = ua.includes("Windows Phone");
22
isIpadOS = ua.includes("Mac OS") && !/iPhone|iPod/.test(ua) && this.touch;
@@ -66,6 +66,10 @@ class Capabilities {
66
},
67
68
69
+ get touch() {
70
+ return anyPointerCourseQuery.matches;
71
+ }
72
+
73
get userHasBeenActive() {
74
return (
75
!("userActivation" in navigator) || navigator.userActivation.hasBeenActive
0 commit comments