Skip to content

blur 与 click 冲突解决 #236

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

Open
smileyby opened this issue Mar 17, 2022 · 0 comments
Open

blur 与 click 冲突解决 #236

smileyby opened this issue Mar 17, 2022 · 0 comments
Labels

Comments

@smileyby
Copy link
Owner

组件内 按钮 绑定 click 且 输入框 绑定了 blur;
则 当 输入框聚焦是,点击按钮会优先触发 blur 事件(由于js单线程,一次仅执行一个事件,且 blur 优先级更高)

所以 这里需要采用比 blur 优先级更高的 mousedown 或 mouseup 事件 替代 click

优先级:mousedown > mouseup > click

@smileyby smileyby added the JavaScript ☀️ JavaScript label Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant