-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[TextField] Spurious onBlur() with undefined event #9027
Comments
@nareshbhatia This is a nice finding. The logic was introduced in order to fix #8811. What do you think of asserting that the event is defined before triggering the property callback here? |
@oliviertassinari, I think that would work perfectly. It is essentially what I am doing in my event handler, but better to catch this upstream in the framework code. |
@nareshbhatia Do you want to give it a try? |
Sure. Will send you a PR. |
@oliviertassinari in current stable version (v0.19.x) it is not possible to use If so, where do you recommend to validate the fields? (onChange)? |
@reznord I have no clue. |
onBlur() is being called on a TextField with event parameter as
undefined
Expected Behavior
onBlur()
should always be called with an event.Current Behavior
In some situations,
onBlur()
is being called with an undefined event.Steps to Reproduce (for bugs)
I am not able to reproduce this in a small example, but I can tell you which code path is making this spurious call to
onBlur
. The culprit is essentially thecomponentWillUpdate()
method in Input.js. See here.muiFormControl.onBlur()
, without passing an event!!!this.props.onBlur(event)
, which is my event handler that gets an undefined event.Context
This issue is requiring me to check for an undefined event in the beginning of my event handler.
Your Environment
The text was updated successfully, but these errors were encountered: