Improved device input abstraction #15
Description
I would like to propose a greater abstraction from the top level composite events that the browser provides. This would allow developers building applications with react to avoid the complexity of composite events and heuristics that plague most cross-input applications.
https://github.com/facebook/react/issues/2061is the perfect example.
Depending on the UA, touchstart
, touchmove
, and touchend
event details, and backwards-compatibility heuristics, the subsequent click
event will often be delayed from the original user events by ~300ms. The fragmentation of UA implementations has only gotten worse in time (Chrome disabling it with certain heuristics like the <meta name="viewport" content="width=device-width">
with iOS8 introducing it’s own set of heuristics (ftlabs/fastclick#262 (comment)).
I believe that there is a great opportunity for React to take a step away from the browser event pipeline and do the sensible thing for the 95%. Begin with the click
event, then move on to a sensible API for mouse, touch and pointer events.
To quote @petehunt
There is a lot of stuff you get for free when you build like the browser doesn’t exists and this is one thing that distinguishes React from Web Components and Polymer and that kind of thing …they’re getting closer and closer in with the browser, and we’re getting farther and farther from the browser. And I think that our technique is more sustainable in the long term.