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

Mouse enter and leave work consistently with disabled elements #5762

Closed
wants to merge 2 commits into from
Closed

Mouse enter and leave work consistently with disabled elements #5762

wants to merge 2 commits into from

Conversation

jquense
Copy link
Contributor

@jquense jquense commented Jan 1, 2016

makes an attempt at fixing #4251.

First, I added support for native mouseenter and mouseleave, I am not sure why they weren't used before, there may have been a good reason I didn't realize :)

This drastically changes how enter|leave is implemented, modeled after the jQuery approach. I tried to keep with the current implementation but browsers just don't fire the necessary mouse events so it seemed that there was no way to "fix" the current approach.

The EnterLeave logic is pretty deeply integrated so I am not sure I added the various utils in the right spot to maintain correct encapsulation.

While fairly easy to implement with normal handlers the React event system made this sort of tough since you don't know interested nodes. One concern with this approach is that it needs to walk up the instance tree for every mouseout|over event fired to try and find a parent node listening for enter|leave. I thought this approach was more in keeping with how stuff works other places, but I wasn't sure if it represents an unacceptable philosophical or perf concern (my light testing didn't seem to indicate that).

Alternatively I could have just used the didPutListener hook to manually attach mouse over|out listeners.

There could also be a hook or accumulation pattern that does this already that I missed.

thanks for all the hard work ya'll and Happy new years!

@jimfb
Copy link
Contributor

jimfb commented Jan 8, 2016

@spicyj @syranide We really want to be more responsive to @jquense's PRs (he has been doing really good work, and has been very patient with us). Can someone with expertise in this area of the core take a look? Thanks!

@facebook-github-bot
Copy link

@jquense updated the pull request.

@jquense
Copy link
Contributor Author

jquense commented Jan 28, 2016

Ping. Anything I can do here?

React = require('React');
ReactDOM = require('ReactDOM');
ReactDOMComponentTree = require('ReactDOMComponentTree');
it('should use native mouseenter is supported', function() {

Choose a reason for hiding this comment

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

should use native mouseenter if it is supported

@jquense
Copy link
Contributor Author

jquense commented Feb 17, 2016

anyone have any thoughts about this? ran into this bug again today.

Perhaps its less controversial to add native event support separate from rewriting the polyfill?

@facebook-github-bot
Copy link

@jquense updated the pull request.

@afc163
Copy link

afc163 commented May 23, 2016

any process?

@ghost ghost added the CLA Signed label Jul 12, 2016
@benjycui
Copy link
Contributor

benjycui commented Dec 6, 2016

ping~

@nhunzaker
Copy link
Contributor

@jquense I'll help see this through if you're still game, otherwise I'm happy to pick this up.

screen shot 2017-05-11 at 8 59 51 pm

Does this mean the fork disappeared? Frustrating. Either way, this seems valuable. I'd even be happy to write some DOM fixtures for it.

@jquense
Copy link
Contributor Author

jquense commented May 13, 2017

I don't know where the branch went!

adding support for the native event should be fine I think still. I meant to split it out but haven't gotten to it. The polyfill was a lot more contentious, we ended up at "no one feels comfortable changing the logic here because its super complex and old and no one remembers why it's that way"

@nhunzaker
Copy link
Contributor

nhunzaker commented May 15, 2017

adding support for the native event should be fine I think still. I meant to split it out but haven't gotten to it.

Is that something you'd be willing to take on still (edit: splitting out the native event support)? That just involves plugging up the event registry key/value pairs, rough in here, right?

In the mean time, @sebmarkbage do we want to polyfil mouse enter/leave? You've mentioned wanting to trim down ReactDOM, I'm not sure where you'd want to draw the line in the sand for where React polyfills inconsistent browser behavior.

@paranoidjk
Copy link

paranoidjk commented May 17, 2017

LGTM, any progress? I think it could be helpful if react can do this polyfill.

@sebmarkbage
Copy link
Collaborator

@nhunzaker I'm ok with any fix that mimics what modern browsers do by default if we attach listeners directly to the nodes since that brings our behavior closer to what the minimal implementation would be.

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.

9 participants