Skip to content

Commit

Permalink
fix: document not defined error during SSR fixes #2073
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenjason89 committed Oct 12, 2022
1 parent 876fdda commit 195c806
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dd-touch.ts
Expand Up @@ -10,7 +10,7 @@ import { DDManager } from './dd-manager';
* should we use this instead ? (what we had for always showing resize handles)
* /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
*/
export const isTouch: boolean = ( 'ontouchstart' in document
export const isTouch: boolean = typeof window !== 'undefined' && ( 'ontouchstart' in document
|| 'ontouchstart' in window
// || !!window.TouchEvent // true on Windows 10 Chrome desktop so don't use this
|| ((window as any).DocumentTouch && document instanceof (window as any).DocumentTouch)
Expand Down

0 comments on commit 195c806

Please sign in to comment.