-
-
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
Violation: non-passive event listener #950
Comments
I have also noticed this, though it seems tough to deal with because there are legitimate cases for both passive and active handlers. As far as I know, the pattern to deal with the It's probably possible to extend that concept to accept more boolean options, but I think that could get hairy as more are added--and what if there's a future option that isn't boolean? To make this extensible, the only thing I can think of at the moment is to allow a new form of the prop that can accept more arguments than a singular callback. For example, in jsx... <div onTouchStart={[this.onTouchStart, { capture: true, passive: true }]} /> Just an idea. |
@MaxPower15 I recall there was talk of a syntax like that going into React too. Another issue with boolean flags like |
Well, one thing we could do, since The downside/weirdness to that solution is: what if you want multiple listeners with different options? Seems like a super edge case, but maybe that's the case where I'd support a special suffix on the key that says "this is onTouchStart but a different version." Like: <div
onTouchStart1={[this.onTouchStart1, { capture: true, passive: true }]}
onTouchStart2={[this.onTouchStart2, { capture: false, passive: true }]}
onTouchStart3={[this.onTouchStart3, { capture: false, passive: false }]}
/> That could be an interesting way generally to support multiple bindings for a single event type IMO. Anyway, I guess for compatibility you'd need to wait for React proper to make a decision about how they want to handle this, right? Any idea where that discussion is taking place? |
React's decision on this would be an important factor, but we can also experiment. |
This issue is a duplicate of #428, and thus is better discussed there. If the number of open issues should be limited, this one can be closed |
Good call! I'll close this one in favor of #428 👍 |
preact.esm.js:235 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
The text was updated successfully, but these errors were encountered: