Skip to content

Commit 5bb583b

Browse files
authored
Merge pull request #2075 from stephenjason89/master
fix: document not defined error during SSR fixes #2073
2 parents 876fdda + 195c806 commit 5bb583b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dd-touch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { DDManager } from './dd-manager';
1010
* should we use this instead ? (what we had for always showing resize handles)
1111
* /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
1212
*/
13-
export const isTouch: boolean = ( 'ontouchstart' in document
13+
export const isTouch: boolean = typeof window !== 'undefined' && ( 'ontouchstart' in document
1414
|| 'ontouchstart' in window
1515
// || !!window.TouchEvent // true on Windows 10 Chrome desktop so don't use this
1616
|| ((window as any).DocumentTouch && document instanceof (window as any).DocumentTouch)

0 commit comments

Comments
 (0)