Skip to content

Mouse enter and leave work consistently with disabled elements#5762

Closed
jquense wants to merge 2 commits into
react:masterfrom
jquense:mouse-enter-leave
Closed

Mouse enter and leave work consistently with disabled elements#5762
jquense wants to merge 2 commits into
react:masterfrom
jquense:mouse-enter-leave

Conversation

@jquense

@jquense jquense commented Jan 1, 2016

Copy link
Copy Markdown
Contributor

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

jimfb commented Jan 8, 2016

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

@jquense updated the pull request.

@jquense

jquense commented Jan 28, 2016

Copy link
Copy Markdown
Contributor Author

Ping. Anything I can do here?

Copy link
Copy Markdown

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

jquense commented Feb 17, 2016

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor

@jquense updated the pull request.

@afc163

afc163 commented May 23, 2016

Copy link
Copy Markdown

any process?

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

benjycui commented Dec 6, 2016

Copy link
Copy Markdown
Contributor

ping~

@nhunzaker

Copy link
Copy Markdown
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

jquense commented May 13, 2017

Copy link
Copy Markdown
Contributor Author

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

nhunzaker commented May 15, 2017

Copy link
Copy Markdown
Contributor

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

paranoidjk commented May 17, 2017

Copy link
Copy Markdown

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

@sebmarkbage

Copy link
Copy Markdown
Contributor

@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