Description
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
Global window.event
is overwritten in React 16.5+ in development mode. Here're minimal repro steps:
- React 16.5.2 in dev mode: https://jsfiddle.net/sergei_startsev/ecz103vL/2/
If you click the button, you see DOMContentLoaded
event type.
What is the expected behavior?
The current behavior contradicts with specified behavior window property event returns the Event which is currently being handled by the site's code. Outside the context of an event handler, the value is always undefined
. Moreover it works properly in production mode:
- React 16.5.2 in prod mode: https://jsfiddle.net/sergei_startsev/st5L8e02/2/
It returns expected click
event type.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
It works properly in React 16.4.2 and prod mode:
- React 16.4.2 in dev mode: https://jsfiddle.net/sergei_startsev/o26L08qw/
The issue is reproduced in Chrome 69. It works properly in FF 62 (window.event
isn't support in 62, however it should be reproduced in FF 63 - it was recently added, see details).
It seems that the issue was introduced by @ConradIrwin in #11696.