Skip to content

Use of deprecated and fragile window.event in useRootClose.ts #1044

@wolfbeast

Description

@wolfbeast

Describe the bug

In the file useRootClose.ts line91 you're using the fragile and deprecated window.event global event handler. This is causing issues with browser engines that have followed standards deprecation and disabled this by default, leading to subtle errors and unexpected behaviour (without throwing) on sites that make use of this component.

The solution should be straightforward: use the event passed into the event handler instead (a cursory glance seems to indicate that that is e in this case?

To Reproduce

Steps to reproduce the behaviour:

  1. Switch of window.event support (e.g. in Firefox, pref it off)
  2. Go to a site that uses react-overlays, e.g. this mastodon instance
  3. Try to click ALT on the image
  4. Nothing happens

Reproducible Example

see above

Expected behaviour

It should pop up a tooltip but the event is lost (often, but sometimes not).

Environment (please complete the following information)

  • Operating System: Windows 10
  • Browser, Version: Pale Moon 33.8.1.2
  • react-overlays Version: not sure, seems to be used on trunk/latest this way

Additional context

This bug was discovered by one of our users (Kris_88) on our forum. Full context in this thread:
https://forum.palemoon.org/viewtopic.php?f=70&t=32635

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions