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

form.resetFields() 后 focus 操作失效 #25028

Closed
1 task done
BugHiding opened this issue Jun 16, 2020 · 2 comments
Closed
1 task done

form.resetFields() 后 focus 操作失效 #25028

BugHiding opened this issue Jun 16, 2020 · 2 comments
Labels
improvement improve some features Inactive

Comments

@BugHiding
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 点击 reset 按钮

What is expected?

focus 到对应输入框

What is actually happening?

未 focus 到对应输入框

remark

inputEl.current.input.focus();inputEl.current.focus(); 都可以聚焦,顺便想问一下应该使用哪一个,谢谢。

Environment Info
antd 4.3.4
React 16.13.1
System macOS 10.15.5
Browser Chrome 83.0.4103.97
@zombieJ
Copy link
Member

zombieJ commented Jun 16, 2020

  1. reset 会重置组件,后面立刻跟 focus 是聚焦不到的。感觉可以 reset 返回一个 Promise 让用户知道什么时候 reset 重置完成了。

  2. .current.focus()

@zombieJ zombieJ added the improvement improve some features label Jun 16, 2020
@crazyair
Copy link
Member

crazyair commented May 12, 2021

  1. reset 会重置组件,后面立刻跟 focus 是聚焦不到的。感觉可以 reset 返回一个 Promise 让用户知道什么时候 reset 重置完成了。
  2. .current.focus()

Promise 没实现吗?或者 reset 后 callback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement improve some features Inactive
Projects
None yet
Development

No branches or pull requests

4 participants