Skip to content

Commit c1621a3

Browse files
committed
Add documentation for non-passive event listeners
1 parent 25bfa9a commit c1621a3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Magnifier.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export default class Magnifier extends PureComponent {
9191
}
9292

9393
componentDidMount() {
94-
// Add non-passive event listeners to image img (assigned in render function)
94+
// Add mouse/touch event listeners to image element (assigned in render function)
95+
// `passive: false` prevents scrolling on touch move
9596
this.img.addEventListener('mousemove', this.onMouseMove, { passive: false });
9697
this.img.addEventListener('mouseout', this.onMouseOut, { passive: false });
9798
this.img.addEventListener('touchstart', this.onTouchStart, { passive: false });

0 commit comments

Comments
 (0)