Skip to content

Global window.event is overwritten in React 16.5+ in development mode.  #13688

Closed
@sergei-startsev

Description

@sergei-startsev

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:

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:

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions