From ab5febb484f2c8ebfed114459731ba65be20dfa2 Mon Sep 17 00:00:00 2001 From: Veeck Date: Thu, 28 Feb 2019 10:20:58 +0100 Subject: [PATCH] Fix touch event detection for Chrome >= 70, see https://www.chromestatus.com/feature/4764225348042752 (#2409) --- feature-detects/touchevents.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature-detects/touchevents.js b/feature-detects/touchevents.js index c5ef8134c5..49ebe39562 100644 --- a/feature-detects/touchevents.js +++ b/feature-detects/touchevents.js @@ -35,8 +35,9 @@ This test will also return `true` for Firefox 4 Multitouch support. */ define(['Modernizr', 'prefixes', 'mq'], function(Modernizr, prefixes, mq) { // Chrome (desktop) used to lie about its support on this, but that has since been rectified: https://bugs.chromium.org/p/chromium/issues/detail?id=36415 + // Chrome also changed its behaviour since v70 and recommends the TouchEvent object for detection: https://www.chromestatus.com/feature/4764225348042752 Modernizr.addTest('touchevents', function() { - if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { + if (('ontouchstart' in window) || window.TouchEvent || window.DocumentTouch && document instanceof DocumentTouch) { return true; }