[antd] Losing focus on first entered character when I use a custom FieldTemplate or ObjectFieldTemplate
See original GitHub issuePrerequisites
- I have read the documentation;
- In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.
- Ideally, I’m providing a sample JSFiddle or a shared playground link demonstrating the issue.
Description
I am trying to use a fieldtemplate to change the layout of each field of the form. When I add my field template to the parameters of the form and use setState in componentDidMount , and I try to use any input, I lose the focus almost instantly. It is a behaviour I am not having without the fieldtemplate or objectFieldTemplate.
Steps to Reproduce
- [enter a character]
Expected behavior
I can enter any character.
Actual behavior
focus is lost
Demo
https://github.com/NaccOll/rjsf-custom-fieldtemplate
Version
You can usually get this information in your package.json
or in the file URL if you’re using the unpkg one.
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/icons": "^4.2.2",
"@rjsf/antd": "^2.4.0",
"@rjsf/core": "^2.4.0",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"antd": "^4.7.3",
"dayjs": "^1.9.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:15
Top Results From Across the Web
javascript - react-jsonschema-form input box out of focus when ...
The problem is that I'm using ObjectFieldTemplate and every time I enter a character in one of the string input boxes, the box...
Read more >Advanced customization - React Jsonschema form
To fully customize an object field template, you may need to specify both ui:FieldTemplate and ui:ObjectFieldTemplate . Error List template¶. To take control ......
Read more >Input - Ant Design
A basic widget for getting the user input is a text field. Keyboard and mouse can be used for providing or changing data....
Read more >User Manual for Kingdee K/3 V12.1 BOS Plug-in Development
This manual is intended for users who have extensive related experience and expertise, and who are already familiar with the basics of the ......
Read more >Set Up and Maintain Sales Tools - manualzz
Customize Application and Modify All Data. 2. If it's your first time visiting the Sales Cloud Einstein Setup Assistant, click Get Started.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Was fixed, extracting the function ObjectFieldTemplate out of the component.
Hi @NaccOll , I also ran into this problem, Please read this question: https://stackoverflow.com/questions/56064571/react-text-input-loses-focus-when-i-type-a-letter