-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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
Add warnings for onFocusIn and onFocusOut props #6296
Conversation
@@ -187,6 +187,11 @@ function assertValidProps(component, props) { | |||
'those nodes are unexpectedly modified or duplicated. This is ' + | |||
'probably not intentional.' | |||
); | |||
warning( | |||
props.onFocusIn == null && props.onFocusOut == null, | |||
'Props onFocusIn and onFocusOut are no longer supported. Use onFocus and ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: they were never supported in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gaearon, updated!
@jontewks updated the pull request. |
1 similar comment
@jontewks updated the pull request. |
props.onFocusIn == null && | ||
props.onFocusOut == null, | ||
'Props onFocusIn and onFocusOut are not supported. Use onFocus and ' + | ||
'onBlur events instead because they are normalized across browsers.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users can use onFocus
in leu of onFocusIn
because the React variant bubbles. We actually deviate from the standard here, so it's more than just "normalization across browsers".
Perhaps:
React uses
onFocus
andonBlur
instead ofonFocusIn
andonFocusOut
. All React events are normalized to bubble, soonFocusIn
andonFocusOut
are not needed/supported by React.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, I've updated the error message.
Seems fine to me, minor nit for the error message and then I think we can take this. |
@jimfb let me know if anything else should be done for this one, thanks! |
Looks good, thanks @jontewks! |
Resolves #6275