[Do not merge] Attach all local listeners as captured events #11832
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed in #9333 that events that don't bubble are still captureable (scroll, wheel). So that got me curious about all of the other events we attach locally for that very reason.
I've used the following test page to confirm this:
https://codepen.io/nhunzaker/pen/babXLO
https://codepen.io/anon/pen/YYKoJW?editors=1010
What I need help with
Is this even a good idea? 馃槢. Are there any design issues with using captured events this way?
Right now, this PR only moves the local attachment over, as needed, to ReactBrowserEventEmitter. There is a more aggressive change: what if we attached all events as capture? Period. Given bubbling is synthetic anyway, what could go wrong if we attached everything using capture? Then we wouldn't really need to distinguish local listeners other the handful we have for focus and scrolling.
Things that still need confirmation:
So basically media events are left. For all the others, I've tested:
** No SVG Load event
** Details are not supported
** Details does not dispatch until Safari 10.1 - https://codepen.io/nhunzaker/pen/qpBWqo
** No SVG Load event - SVG image onLoad event not getting dispatched on IE11聽#11058
** Details are not supported
** Details does not dispatch until Android 5 - https://codepen.io/nhunzaker/pen/qpBWqo
** Details does not dispatch until Safari 10.1 - https://codepen.io/nhunzaker/pen/qpBWqo