Skip to content

Passive event listeners #810

@robagar

Description

@robagar

Enhancement

Chrome has taken to logging a warning if you add a listener to scroll events.

[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive.

These warnings can be prevented by indicating that the listener is passive and will not call event.preventDefault() by passing { passive: true } when the event listener is added. Similarly, passing { passive: false } indicates that the listener is not passive, and should disable the warning.

Code

<div
  onwheel={(event) => { ...anything... }}
/>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions