-
Notifications
You must be signed in to change notification settings - Fork 49.2k
Closed
Labels
Description
Chrome did an "intervention" back in the day, breaking all React touch and wheel listeners which used e.preventDefault()
(#14856) because React happened to attach them to the document
.
In React 17, events are no longer attached to the document
. This happens to "undo" Chrome's intervention (#6436 (comment)). However, since this functionality is already broken in 16 and we haven't patched it up, it seems like this would just be a performance regression for the majority of cases.
It seems like we have a few options:
- In the spirit of Chrome's "fix", keep touch listeners passive by default.
e.preventDefault()
is broken, just like it got broken in 16 by Chrome.- In this case, it is still a pain point that React offers no native API to intentionally attach an active listener for the case where you want to use
e.preventDefault()
.
- In this case, it is still a pain point that React offers no native API to intentionally attach an active listener for the case where you want to use
- Do nothing, in which case Chrome's intervention would effectively be undone for React apps. There is an argument that Chrome itself only felt comfortable doing it for the
document
level and not individual elements — and conceptually React users were putting their handlers on individual elements. Delegation is just an implementation detail. - Not use delegation for touch/wheel listeners at all (?)
Filing this to be resolved before 17 final.
oliviertassinari, styfle, MilllerTime, witran, NE-SmallTown and 4 more