Files
gitlab-ce/app/assets/javascripts/lib/utils/touch_detection.js
2025-07-22 00:11:54 +00:00

14 lines
411 B
JavaScript

/**
* Detects if the current device has touch capability
*
* @returns {boolean} True if device has touch capability, false otherwise
*/
export function hasTouchCapability() {
return Boolean(
'ontouchstart' in window ||
navigator.maxTouchPoints > 0 ||
navigator.msMaxTouchPoints > 0 ||
(typeof window.DocumentTouch !== 'undefined' && document instanceof window.DocumentTouch),
);
}