Skip to content

Commit

Permalink
Add passive mode touch events, calms Lighthouse
Browse files Browse the repository at this point in the history
  • Loading branch information
inoas authored Apr 10, 2020
1 parent 6eb8440 commit 3b433df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Slideout.prototype._initTouchEvents = function() {
}
};

doc.addEventListener(touch.move, this._preventMove);
doc.addEventListener(touch.move, this._preventMove, {passive: true});

/**
* Resets values on touchstart
Expand All @@ -222,7 +222,7 @@ Slideout.prototype._initTouchEvents = function() {
self._preventOpen = (!self._touch || (!self.isOpen() && self.menu.clientWidth !== 0));
};

this.panel.addEventListener(touch.start, this._resetTouchFn);
this.panel.addEventListener(touch.start, this._resetTouchFn, {passive: true});

/**
* Resets values on touchcancel
Expand All @@ -232,7 +232,7 @@ Slideout.prototype._initTouchEvents = function() {
self._opening = false;
};

this.panel.addEventListener('touchcancel', this._onTouchCancelFn);
this.panel.addEventListener('touchcancel', this._onTouchCancelFn, {passive: true});

/**
* Toggles slideout on touchend
Expand All @@ -245,7 +245,7 @@ Slideout.prototype._initTouchEvents = function() {
self._moved = false;
};

this.panel.addEventListener(touch.end, this._onTouchEndFn);
this.panel.addEventListener(touch.end, this._onTouchEndFn, {passive: true});

/**
* Translates panel on touchmove
Expand Down Expand Up @@ -297,7 +297,7 @@ Slideout.prototype._initTouchEvents = function() {

};

this.panel.addEventListener(touch.move, this._onTouchMoveFn);
this.panel.addEventListener(touch.move, this._onTouchMoveFn, {passive: true});

return this;
};
Expand Down

0 comments on commit 3b433df

Please sign in to comment.