Skip to content

Commit 3b433df

Browse files
authored
Add passive mode touch events, calms Lighthouse
Refs: Mango#291 Mango#289 Mango#267
1 parent 6eb8440 commit 3b433df

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Slideout.prototype._initTouchEvents = function() {
206206
}
207207
};
208208

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

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

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

227227
/**
228228
* Resets values on touchcancel
@@ -232,7 +232,7 @@ Slideout.prototype._initTouchEvents = function() {
232232
self._opening = false;
233233
};
234234

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

237237
/**
238238
* Toggles slideout on touchend
@@ -245,7 +245,7 @@ Slideout.prototype._initTouchEvents = function() {
245245
self._moved = false;
246246
};
247247

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

250250
/**
251251
* Translates panel on touchmove
@@ -297,7 +297,7 @@ Slideout.prototype._initTouchEvents = function() {
297297

298298
};
299299

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

302302
return this;
303303
};

0 commit comments

Comments
 (0)