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

[input] 失焦逻辑无法正确触发 #3963

Closed
Yaxnice301 opened this issue Feb 23, 2024 · 5 comments · Fixed by #4032
Closed

[input] 失焦逻辑无法正确触发 #3963

Yaxnice301 opened this issue Feb 23, 2024 · 5 comments · Fixed by #4032

Comments

@Yaxnice301
Copy link

tdesign-vue-next 版本

目前 1.8.1版本 可以重现

重现链接

https://tdesign.tencent.com/vue-next/components/form#登录表单

重现步骤

  • 先用鼠标点击用户名输入框
  • 使用TAB键将焦点切换到密码输入框

期望结果

用户名输入框应当失去焦点,而密码输入框获得焦点

实际结果

两个输入框同时获得焦点(样式)

框架版本

vue3.4.18

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

经过测试,我发现失焦函数 onblur 没有触发
如果反复 失焦、聚焦 可以发现 onblur 函数在间隔触发(一次触发一次不触发)

Copy link
Contributor

👋 @Yaxnice301,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

Copy link
Contributor

♥️ 有劳 @kidjayhuang @mokywu @youuss 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @Yaxnice301

@Yaxnice301
Copy link
Author

这个问题在所有的输入组件上都存在,而且有一些似乎是概率触发,我不确定

@Anturin
Copy link

Anturin commented Mar 7, 2024

我提过了,似乎一直没有人处理,这个是百分百还原
#3903 (comment)

@XBIsland
Copy link
Contributor

useInput.ts 中的 formatAndEmitBlur 中判断了 isHover 导致的,这里应该不需要这个判断。

const formatAndEmitBlur = (e: FocusEvent) => {
if (isHover.value) return;
if (!isClearIcon()) {
if (props.format) {
inputValue.value =
typeof innerValue.value === 'number' || props.type === 'number'
? innerValue.value
: props.format(innerValue.value);
}
focused.value = false;
props.onBlur?.(innerValue.value, { e });
formItem?.handleBlur();
} else {
focus();
}
};

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

Successfully merging a pull request may close this issue.

3 participants