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

Set the focus event of the naiveui input component to open modal, click the input clear button, and clear will fail #6411

Open
5 tasks done
scw919 opened this issue Sep 30, 2024 · 6 comments

Comments

@scw919
Copy link

scw919 commented Sep 30, 2024

Describe the bug

Set the focus event of the naiveui input component to open a pop-up window, click the input clear button, and clear will fail

Steps to reproduce

1.Set the focus event of the naiveui input component to open a pop-up window,
2.Click the input clear button, and clear will fail

Link to minimal reproduction

https://codepen.io/scw919/pen/GRVpNNj

System Info

System:
  OS: Microsoft Windows 10 专业版 10.0.19042 暂缺 Build 19042
  CPU: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz 
  Memory: 28.13 GB / 63.77 GB
Binaries:
  Node: v18.12.0
  Yarn: 1.22.17
  npm: 8.19.2
Browsers:
  Edge: Chromium (109.0.5414.120)

Used Package Manager

npm

Validations

@scw919 scw919 added the untriaged need to sort label Sep 30, 2024
@scw919 scw919 changed the title Set the focus event of the naiveui input component to open a pop-up window, click the input clear button, and clear will fail Set the focus event of the naiveui input component to open modal, click the input clear button, and clear will fail Sep 30, 2024
@jahnli
Copy link
Collaborator

jahnli commented Sep 30, 2024

使用 on-clear

@jahnli jahnli closed this as completed Sep 30, 2024
@scw919
Copy link
Author

scw919 commented Sep 30, 2024

使用 on-clear

image
这样也不行,一旦在focus事件中执行弹窗展示,清除按钮的click事件就失效了

@scw919
Copy link
Author

scw919 commented Sep 30, 2024

focus是mousedown触发的 click在mousedown事件执行完弹窗展示后并未执行

@jahnli jahnli reopened this Sep 30, 2024
@jahnli
Copy link
Collaborator

jahnli commented Sep 30, 2024

不确定算算 BUG

@scw919
Copy link
Author

scw919 commented Sep 30, 2024

不确定算算 BUG

目前我们项目中就遇到这个问题,产品是提了缺陷的,产品视角用户点击清空肯定是首先要完成清空操作的;
我目前的解决方案:1、可以通过clear-icon插槽在自定义的清除按钮上阻止冒泡,这样就不会触发focus
2、通过自定义mousedown事件,判断是否是点击了清空按钮,是的话就自己调用清空输入框绑定的值

@scw919
Copy link
Author

scw919 commented Sep 30, 2024

不确定算算 BUG

目前我们项目中就遇到这个问题,产品是提了缺陷的,产品视角用户点击清空肯定是首先要完成清空操作的; 我目前的解决方案:1、可以通过clear-icon插槽在自定义的清除按钮上阻止冒泡,这样就不会触发focus 2、通过自定义mousedown事件,判断是否是点击了清空按钮,是的话就自己调用清空输入框绑定的值

但我还是觉得这个应该修复下,哪怕是给使用者一个可以配置的选择

@jahnli jahnli added consideration-needed and removed untriaged need to sort labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants