Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings from @wordpress/no-global-event-listener ESLint rule #5731

Closed
johnwatkins0 opened this issue Dec 22, 2020 · 1 comment · Fixed by #5732
Closed

Fix warnings from @wordpress/no-global-event-listener ESLint rule #5731

johnwatkins0 opened this issue Dec 22, 2020 · 1 comment · Fixed by #5732
Labels
WS:Core Work stream for Plugin core
Milestone

Comments

@johnwatkins0
Copy link
Contributor

johnwatkins0 commented Dec 22, 2020

Bug Description

As a result of a recent update to one of the @wordpress packages, we're now seeing these warnings on all PRs:

Screen Shot 2020-12-22 at 11 53 01 AM

Text: "[@wordpress/no-global-event-listener] Avoid using (add|remove)EventListener with globals. Use ownerDocument or ownerDocument.defaultView on a node ref instead."

Should be easy to fix simply by doing what the warning says.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

@johnwatkins0 johnwatkins0 self-assigned this Dec 22, 2020
@johnwatkins0 johnwatkins0 added the WS:UX Work stream for UX/Front-end label Dec 22, 2020
@johnwatkins0 johnwatkins0 added WS:Core Work stream for Plugin core and removed WS:UX Work stream for UX/Front-end labels Dec 22, 2020
@johnwatkins0 johnwatkins0 removed their assignment Dec 22, 2020
@johnwatkins0
Copy link
Contributor Author

On closer look, it might be best to simply disable the rule in files that are not using React. My interpretation of the new rule is that it's mainly intended to guard against reaching outside the virtual DOM in React contexts. See WordPress/gutenberg#26810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WS:Core Work stream for Plugin core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants