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

autoFocus in Textarea in modal such as [Modal.confirm] doesn't work #45626

Closed
LizaMaharjan opened this issue Nov 2, 2023 · 5 comments
Closed
Labels
🤔 Need Reproduce We cannot reproduce your problem unconfirmed

Comments

@LizaMaharjan
Copy link

LizaMaharjan commented Nov 2, 2023

Reproduction link

Edit on CodeSandbox

  • I would appreciate it if you could demonstrate possible solutions given the CodeSandbox

Steps to reproduce

  • Click on open
  • The input/ text area in the modal doesn't get focused even after using getContainer prop

What is expected?

  • The input or textarea that is inside the Modal.confirm modal should be focused on clicking 'Open'

What is actually happening?

  • The input/ text area in the modal doesn't get focused even after using getContainer prop
Environment Info
antd 5.9.4
React 18.2.0
System Mac
Browser Chrome

  • This case is only for 'Modal.confirm' which im using it to show different cases of info, success, warning conditions.
@afc163 afc163 added the 🤔 Need Reproduce We cannot reproduce your problem label Nov 2, 2023
Copy link
Contributor

github-actions bot commented Nov 2, 2023

Hello @LizaMaharjan2001. Please provide a online reproduction by forking codesandbox of antd@5.x or antd@4.x, or provide a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @LizaMaharjan2001, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 antd@5.xantd@4.x 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

@LizaMaharjan
Copy link
Author

LizaMaharjan commented Nov 2, 2023

@MadCcc @zombieJ I've forked the codeSandbox, not sure why it wasn't recorded, please help!

@MadCcc
Copy link
Member

MadCcc commented Nov 2, 2023

Modal.confirm will focus on OK button automaticly, that's why textarea didn't get focused.
Use autoFocusButton: null to avoid auto focusing.

@MadCcc MadCcc closed this as completed Nov 2, 2023
@LizaMaharjan
Copy link
Author

@MadCcc it still didn't worked for my case.
I've demonstrated my issue into the codesandbox here: https://codesandbox.io/s/static-method-antd-5-10-3-forked-5kr3l2?file=/demo.tsx
Please have a look on what i missed or did wrong.

@afc163
Copy link
Member

afc163 commented Nov 2, 2023

See #41239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem unconfirmed
Projects
None yet
Development

No branches or pull requests

3 participants