Skip to content

Commit

Permalink
[fix] add timeout to Form's onBlur method to prevent focus losing whe…
Browse files Browse the repository at this point in the history
…n toggling checkboxes
  • Loading branch information
fabioh8010 committed Mar 23, 2023
1 parent fb90cd8 commit 5deed50
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ class Form extends React.Component {
value: this.state.inputValues[inputID],
errorText: this.state.errors[inputID] || fieldErrorMessage,
onBlur: () => {
this.setTouchedInput(inputID);
this.validate(this.state.inputValues);
setTimeout(() => {
this.setTouchedInput(inputID);
this.validate(this.state.inputValues);
}, 100);
},
onInputChange: (value, key) => {
const inputKey = key || inputID;
Expand Down

0 comments on commit 5deed50

Please sign in to comment.