mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-10-31 03:52:13 +08:00
Fix#150 Touch devices result in driver blink
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "driver.js",
|
||||
"version": "0.9.5",
|
||||
"version": "0.9.6",
|
||||
"description": "A light-weight, no-dependency, vanilla JavaScript library to drive the user's focus across the page",
|
||||
"main": "dist/driver.min.js",
|
||||
"types": "types/index.d.ts",
|
||||
|
||||
+8
-1
@@ -91,7 +91,14 @@ export default class Driver {
|
||||
bind() {
|
||||
this.window.addEventListener('resize', this.onResize, false);
|
||||
this.window.addEventListener('keyup', this.onKeyUp, false);
|
||||
this.window.addEventListener('click', this.onClick, false);
|
||||
|
||||
// Binding both touch and click results in popup getting shown and then immediately get hidden.
|
||||
// Adding the check to not bind the click event if the touch is supported i.e. on mobile devices
|
||||
// Issue: https://github.com/kamranahmedse/driver.js/issues/150
|
||||
if (!('ontouchstart' in document.documentElement)) {
|
||||
this.window.addEventListener('click', this.onClick, false);
|
||||
}
|
||||
|
||||
this.window.addEventListener('touchstart', this.onClick, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user