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: onPointerEnterCapture and onPointerLeaveCapture result in unknown event handler property #17883

Closed
tommedema opened this issue Jan 21, 2020 · 13 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@tommedema
Copy link

React version: v16.12.0 from https://unpkg.com/react/umd/react.development.js

Steps To Reproduce

  1. attach onPointerEnterCapture to a JSX element
  2. observe unknown event handler property error in console

Link to code example: https://jsfiddle.net/tommedema/1uqoemxs/2/

The current behavior

It displays a unknown event handler property warning

The expected behavior

The capturing phase of the onPointerEnter and onPointerLeave events should be supported

@tommedema tommedema added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jan 21, 2020
@Kelbie
Copy link

Kelbie commented Jan 22, 2020

There is support for pointer-events in v16.4.0:
https://reactjs.org/blog/2018/05/23/react-v-16-4.html

@tommedema
Copy link
Author

@KevinKelbie thanks but that blog post does not list onPointerEnterCapture, only onPointerEnter. Do you know if this is a mistake? I specifically need the capturing phase

@tommedema
Copy link
Author

tommedema commented Mar 19, 2020

@necolas what can I do to help this get fixed? This has been blocking me since Jan 21st. I'm using React 16.13.0

@bl00mber
Copy link
Contributor

@tommedema are you sure this event exist? Can you send a link to ECMA specification?

@necolas
Copy link
Contributor

necolas commented May 19, 2020

It's the same as the mouse event equivalents, they don't bubble and don't have a capture phase: https://reactjs.org/docs/events.html#mouse-events. You should use onPointerOver/Out instead.

@rjgotten
Copy link

@necolas
It's the same as the mouse event equivalents, they don't bubble and don't have a capture phase

You're wrong. While pointerenter doesn't bubble, it definitely does have a capture phase:
https://jsfiddle.net/69xm0t7w/

@necolas
Copy link
Contributor

necolas commented Mar 22, 2024

Not in the React event system. Read the link above.

Screenshot_20240322_074304_Chrome

@rjgotten
Copy link

Then React should fix its TypeScript typings to special case those events to not generate onPointerEnterCapture and onPointerLeaveCapture properties as common element props. Fact that those exist broadcasts they're meant to be supported.

@eps1lon
Copy link
Collaborator

eps1lon commented Mar 22, 2024

@rjgotten We removed these types in the types for 18. We reverted the backport to types for 17 and 16 since it caused too much breakage across the ecosystem due to TypeScript wrongfully inlining types during declaration emit.

@rjgotten
Copy link

rjgotten commented Mar 25, 2024

@eps1lon
We removed these types in the types for 18.

I am using @types/react@18.2.55 and its types still define onPointerEnterCapture on DOMAttributes.
So if they were supposed to be removed, something went wrong.

@eps1lon
Copy link
Collaborator

eps1lon commented Mar 25, 2024

Latest is 18.2.70

@rjgotten
Copy link

rjgotten commented Mar 25, 2024

Latest is 18.2.70

This was a very recent change, then? As in literally as it was brought up in this GH issue's discussion?
Apologies- I was under the impression that this was something that was already done a while ago.

Thanks for straightening out the confusion there.
I'll update the type definitions package on my end to ensure no other developers on my team stub toes on this again.
Great to see a fix for this. 👍

@xiaody
Copy link

xiaody commented Apr 30, 2024

FTR DefinitelyTyped/DefinitelyTyped#68984 [@types/react] fix: remove onPointerEnterCapture & onPointerLeaveCapture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

7 participants