jsun969 / react-hook-form-antd

๐Ÿ“‹๐Ÿœ Master your Ant Design form with React Hook Form! ็”จ React Hook Form ๆ‹ฟๆไฝ ็š„ Ant Design ่กจๅ•๏ผ
https://npm.im/react-hook-form-antd
MIT License
61 stars 10 forks source link

TypeError: elm.focus is not a function #97

Closed snndmnsz closed 4 weeks ago

snndmnsz commented 3 months ago

I get this error when i put Upload component inside FormItem. Probably cannot find the focus bcs of Upload uses button. How can i resolve this?

Ekran Resmi 2024-08-09 02 26 21

Error source:

Ekran Resmi 2024-08-09 02 30 10
jsun969 commented 3 months ago

Have you tried to use the solution in #83 ?

snndmnsz commented 3 months ago

@jsun969 Yes, I did, but it didn't work. I found the solution, tho. React Hook Form tries to focus on the error state. Since upload components have no focusable elements, it throws an "elm.focus is not a function" error. If you set shouldFocusError: false in your useForm, it fixes the problem, but you can't use the focus-on-error functionality anymore. Could you please add this problem to the .md file of this package so that everyone who wants to use uploads in their form can resolve this issue?

jsun969 commented 3 months ago

Yea we should add it in readme. Do you want to make a PR for it?

snndmnsz commented 3 months ago

Yeah, sure.