提交 481fcd06 编写于 作者: K Kamran Ahmed

Fix#150 Touch devices result in driver blink

上级 ca5785ba
{
"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",
......
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册