-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Polyfilling pointer-events #4095
Comments
It looks like both of your links are to the same sandbox, |
Sorry, the one using Preact is this one. edited the original msg. thanks! |
Thanks for the fix! Looks like Line 86 in 4fea40d
This stops the listener from being set correctly, as the event names end up as They might need to be special cased here. Edit: TS won't like it (though you can patch the types or |
Wow you already have a PR. that's truly amazing! |
This would do nothing to address those handlers, no.
|
Oh I really hoped it would... |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Ah, well I'm clearly an idiot. Sorry about that! Will take a look a bit later. Edit: Never mind, I have no way of easily reproducing Safari 12 or alternatives. It's probably an issue with the polyfill, as after #4096, all of those events seem to be working correctly in modern browsers. |
The point was that the polyfill works fine with React's |
Preact certainly is using Keep in mind there is a pretty big gap in React and Preact when it comes to events, in that Preact uses native DOM events while React does not. I have no idea if that's relevant to this issue but it's good to keep in mind that there are some intentional differences in this area. Can you try using lowercase names for the events in your JSX? |
I love you |
I take it that works then? Unfortunately that's what you'll need to use, Preact will only switch |
Yes, excuse my excitement :) |
Glad to hear it! I don't think there's any action we can take on the Preact side, this is the troublesome line: Lines 92 to 93 in 21a6f30
I don't believe it's safe to call You certainly could patch this behavior, adding declare module 'preact' {
namespace JSX {
interface DOMAttributes<Target extends EventTarget> {
onpointerdown?: PointerEventHandler<Target> | undefined;
}
}
} Just copying the source types, but changing event capitalization. |
I really don't mind having it in lowercase, as long as it works on modern browsers, and as long as no other dev sees it and "fixes" it to camelCase. Thank you so much for the responsiveness here, truly impressive. |
Going to close this out in that case, let me know if you run into any further issues and we can reopen. |
First, would like to say thanks for all the work you people put into this.
Now, we're developing a feature relying on pointer-events so that we can handle both mouse and touch events easily.
On old Safari, a polyfill is required for those events to function.
The polyfill seems to work on many demos but I couldn't get it to work in my project.
I tested multiple directions and eventually got to the conclusion that it's probably Preact that is in my way.
Here are two sandboxes:
This one is using React and works on Safari 12 with the polyfill
This one has the exact same component but using Preact, not responsive on Safari 12
Can anyone help explain the issue? Is there anything we can do about it?
Thanks!
The text was updated successfully, but these errors were encountered: