Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastclick导致下拉框焦点冲突 #13

Open
robinson90 opened this issue Dec 5, 2018 · 0 comments
Open

fastclick导致下拉框焦点冲突 #13

robinson90 opened this issue Dec 5, 2018 · 0 comments

Comments

@robinson90
Copy link
Contributor

robinson90 commented Dec 5, 2018

Q: 移动端使用fastclick之后,在ios环境下,有几个连续的下拉框 第一个select框突然填充了第二个下拉框的内容。

A:根本原因是Fastclick导致IOS下多个 select ,点击某一个,焦点不停变换的bug。修改源码,在onTouchStart事件内判断设备是否为IOS,再判断当前nodeName是否为select,如果是return false去阻止fastClick执行其他事件

github源码地址:fastclick.js

//line 391行
FastClick.prototype.onTouchStart = function(event) {

//在其方法中添加判断 符合ios select的时候 不返回事件
if(deviceIsIOS&&this.targetElement =="select")
this.targetElement = null
event.preventDefault();
}

//line521 或者讲源码中 有关touchEnd判断非ios或者非select的事件注释,
if (!deviceIsIOS || targetTagName !== 'select') {
				this.targetElement = null;
			event.preventDefault();
		}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant