Calling blur method on TextInput does not trigger the onBlur handler
See original GitHub issueI am calling the blur method on a TextInput component on the componentDidMount event like so:
componentDidMount() {
this.refs.txtInput.blur();
}
However the onBlur handler that is assigned to this textinput component is not triggered as a result. Do I have the correct expectation or this is not the case.
I have tried calling blur from other methods as well still it does not trigger the handler.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
onblur event is not firing - javascript - Stack Overflow
To have Onblur on an element it should receive focus first, Div elements don't receive focus by default. You can add tabindex="0"
Read more >react-hook-form controlled input onblur doesn't work - You.com
In your code, the form mode is onBlur . it means the validation is triggered on blur event (unfocus the input). When you...
Read more >onblur Event - W3Schools
The onblur event occurs when an element loses focus. The onblur event is often used on input fields. The onblur event is often...
Read more >Element: blur event - Web APIs | MDN
The blur event fires when an element has lost focus. The event does not bubble, but the related focusout event that follows does...
Read more >Client-side Checking with React.js JSX Events Using onBlur
onBlur triggers when focus is lost from the input element in context. In React.js, we bind event handlers by passing a method defined...
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
If the text field already doesn’t have focus (which it probably doesn’t when first mounted) then blur does nothing.
No I had a workaround for validation of all fields on a page where a separate button would trigger validation and would take the user to previous page.
On Sun, 19 Jun 2016, 12:55 AM Žiga Vukčevič notifications@github.com wrote: