facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
228.97k stars 46.85k forks source link

onMouseEnterCapture and onMouseLeaveCapture not working #2826

Closed boljen closed 9 years ago

boljen commented 9 years ago

First off all thank you for building this amazing library and sharing it with the rest of us.

I don't know whether this is a bug in my code, a bug in the library or by design. I suspect it's the latter?

http://jsfiddle.net/682tqxw3/6/

iamdustan commented 9 years ago

I suspect this is a misunderstanding, though I'm not 100% certain or your issue (on phone)

The react API supports the event capturing phase. E.g

document.getElementById('el').addEventListener(event, handler, trueIfCapturePhase);

Not the PointerEvents gotPointerCapture/releasePointerCapture events: https://docs.webplatform.org/wiki/dom/PointerEvent/gotpointercapture

boljen commented 9 years ago

https://docs.webplatform.org/wiki/dom/MouseEvent is the event, more specifically https://docs.webplatform.org/wiki/dom/MouseEvent/mouseenter

gpbl commented 9 years ago

@boljen what are the mouseevent*capture events? I never heard of them... also see the list of mouse events

gaearon commented 9 years ago

what are the mouseevent*capture events? I never heard of them... also see the list of mouse events in react :-)

React clearly has onMouseEnter and onMouseLeave.

Also, from the doc:

The event handlers below are triggered by an event in the bubbling phase. To register an event handler for the capture phase, append Capture to the event name; for example, instead of using onClick, you would use onClickCapture to handle the click event in the capture phase.

So I'd say this does look like a bug.

gpbl commented 9 years ago

Oh nice i was missing that part of the docs. I guess since enter/leave do not bubble it doesn't make sense to have a *Capture there.

sophiebits commented 9 years ago

Yeah, enter/leave have special bubbling and don't have the capture phase. I'll update the docs.