Open visigoth opened 5 years ago
Hello @visigoth. I am having trouble understanding the whole ramifications of what your PR adds. Can you just tell me 1. how you estimate adding those events may impact overall performance & 2. if your PR introduces breaking changes?
react-dom
onXYZ
handlers will now always receive react synthetic events rather than blessed native events. the native event is attached to the synthetic event, so components would potentially need to change a little bit, but not too much.one other thing: this does break things because not all of the events are implemented. only keypress, focus, and blur. all the other events need appropriate entries, but they are not difficult to add.
Implementing react's SyntheticEvent dispatch algorithm and data types enables the use of a wide variety of react components. My personal motivation is
react-hotkeys
, which requiresblur
,focus
, andkey*
events.react-dom
does this by mapping the react event names to native event subscriptions that are required to satisfy them. Then, react-dom pushes them through its event plugin hub, where plugins transform the native event to react events. The generated events then go through the capture and bubble phases.This set of changes implements most of this in a simpler fashion. It would have been nice to simply steal
react
'sevents
package, but it is still private.This set of changes also copies react's SyntheticEvent data types as of 16.8.6.
With this change, the included example works.