-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: 修复select下点击拖出后无法输入值问题,对应issue510 #672
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tusimple/naive-ui/5QpdpnRL6HZjkjyF9nLQtUpPvsnr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changelog 加一下
@@ -332,6 +332,7 @@ export default defineComponent({ | |||
const { nTriggerFormBlur } = formItem | |||
if (onBlur) call(onBlur, e) | |||
nTriggerFormBlur() | |||
triggerRef.value?.blurInput() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
预期中 doBlur 是没有副作用的,这个能挪到别的地方吗?
// outside select, don't need to return focus | ||
closeMenu() | ||
} | ||
// if (mergedShowRef.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能解释一下这么改的影响吗?我没太理解出现 bug 时候发生了啥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
问题是你选中一个元素后,点击该元素按住不放,拖到框以外的部分,就没法输值了
解决方法,在你点击松开时把input和外层包的这个的焦点事件全部失焦,让用户重新去点击选择
这样改暂时没发现有别的影响,功能是正常的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样不是很符合预期,预期是如果原先 focus,拖出去应该继续 focus。
和原生 input 的行为是预期的行为。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在我看来,当你选中移出框外,已经是在外部了,相当于你点击了弹框外,此时应该属于失焦状态而不是继续focus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你试试浏览器的原生 input 和 select,行为和你的描述是不一致的。我们尽量还是维持 native 相同的行为,除非办不到。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那么现在,我是不是应该反向操作一下,保证focus即可,按照这个去改动一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我感觉关键是找到原先出错的原因。我们预期是拖动到外面的过程不要重新 focus 或者 blur,而只是能继续操作。
我之前没有找到出现这个现象的具体原因。
ref #510 |
No description provided.