Skip to content
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

Bug fix for issue 5202 #6226

Merged
merged 1 commit into from
Mar 16, 2016
Merged

Bug fix for issue 5202 #6226

merged 1 commit into from
Mar 16, 2016

Conversation

antsmartian
Copy link
Contributor

Hi All,

Bug fix for #5202. It looks fine to me, however let me know if anything is missing. If not, can add test case and close this! Thanks.

@jimfb jimfb self-assigned this Mar 14, 2016
jimfb added a commit that referenced this pull request Mar 16, 2016
@jimfb jimfb merged commit 93752bb into facebook:master Mar 16, 2016
@jimfb
Copy link
Contributor

jimfb commented Mar 16, 2016

Thanks @antoaravinth!

@quantizor
Copy link
Contributor

No tests?

@jimfb
Copy link
Contributor

jimfb commented Mar 16, 2016

@yaycmyk It's a little annoying to add unit tests for every type of event. Since the native events need to be forged, they're of minimal value anyway, since all you're testing is the forged event. Such tests would make a lot more sense if/when we do in-browser testing (but the tests would need to be written differently anyway, using webdriver/whatever, which we currently don't support).

That said, if you'd like to submit a PR that adds a test for this event type, we'd gladly accept.

@gaearon
Copy link
Collaborator

gaearon commented Mar 16, 2016

Was this the correct fix?

I find it a bit weird that we seem to already normalizing focusin and focusout as part of focus and blur support. Supporting them explicitly seems contrary to the goal of having a normalized event system, especially considering that they are not supported in Firefox.

@@ -296,6 +297,16 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
mountAt
);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.topFocusIn,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't feature detected. Note:

https://developer.mozilla.org/en-US/docs/Web/Events/focusin

Firefox (Gecko): Not supported.

This would need to be normalized, but if we do then it works exactly like focus/blur. So I think we should revert.

@jimfb
Copy link
Contributor

jimfb commented Mar 16, 2016

I think we should still support the event name (or at the very least warn and say "use focus/blur", but that seems dumb). If the behavior is the same in our polyfilled environment, we should just map them to the same behavior/implementation.

@gaearon
Copy link
Collaborator

gaearon commented Mar 16, 2016

If the behavior is the same in our polyfilled environment, we should just map them to the same behavior/implementation.

So far we have tried to have only way to do something. Why break this tradition? It’s the same as class vs className, onClick vs onclick: if we chose one, let’s stick with it.

at the very least warn and say "use focus/blur", but that seems dumb

IMO it actually sounds really sensible. This is a great opportunity to warn the user in a very specific and useful way. I think we should revert this PR but add a warning.

@sebmarkbage
Copy link
Collaborator

Warning is fine. Not sure about mapping it since that means we need to have logic and checks for it in prod. Why is it important to map if there is a warning and we never supported it in the past?

@jimfb
Copy link
Contributor

jimfb commented Mar 16, 2016

👍

@gaearon
Copy link
Collaborator

gaearon commented Mar 16, 2016

This has been reverted in #6274. Sorry about the back and forth on this!
If there’s something about the existing onFocus and onBlur that doesn’t work for you, please let us know. Cheers!

@antsmartian
Copy link
Contributor Author

@gaearon @sebmarkbage Thanks. That make sense and I agree with you guys. Probably I will add warnings as discussed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants