-
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
feat(dialog): add autofocus to resolve open dialog again when pressing Enter Key #1586
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tusimple/naive-ui/DxhvAAH7xotonio85fhyK8DSPbgj [Deployment for 59494f6 failed] |
Codecov Report
@@ Coverage Diff @@
## main #1586 +/- ##
=======================================
Coverage 64.79% 64.80%
=======================================
Files 890 890
Lines 17297 17301 +4
Branches 4098 4099 +1
=======================================
+ Hits 11208 11212 +4
Misses 5313 5313
Partials 776 776
Continue to review full report at Codecov.
|
src/button/src/Button.tsx
Outdated
@@ -142,11 +148,6 @@ const Button = defineComponent({ | |||
return | |||
} | |||
enterPressedRef.value = false |
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.
后面那个为啥去掉了?感觉好像是为了模拟点击的
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.
后面那个为啥去掉了?感觉好像是为了模拟点击的
加了这个 按enter
的时候 会执行两次click事件; 移除就是正常的一次触发
4ee016c
to
9d189bb
Compare
9b67ceb
to
9a9f7d0
Compare
9a9f7d0
to
b000e67
Compare
这块怎么做我再斟酌一下,不是很确定现在这样实现的方式是最合适的 |
b17eeee
to
5b3a4ab
Compare
5b3a4ab
to
2eaf652
Compare
@@ -267,6 +268,7 @@ export default defineComponent({ | |||
themeOverrides={mergedTheme.peerOverrides.Button} | |||
disabled={loading} | |||
loading={loading} | |||
internalAutoFocus={!this.negativeText} |
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 不确认
close #1559