diff --git a/src/UserActivity.js b/src/UserActivity.js index 6b918f0729..8b136c0bcc 100644 --- a/src/UserActivity.js +++ b/src/UserActivity.js @@ -33,7 +33,9 @@ class UserActivity { document.onkeypress = this._onUserActivity.bind(this); // can't use document.scroll here because that's only the document // itself being scrolled. Need to use addEventListener's useCapture. - window.addEventListener('scroll', this._onUserActivity.bind(this), true); + // also this needs to be the wheel event, not scroll, as scroll is + // fired when the view scrolls down for a new message. + window.addEventListener('wheel', this._onUserActivity.bind(this), true); this.lastActivityAtTs = new Date().getTime(); this.lastDispatchAtTs = 0; } @@ -44,11 +46,11 @@ class UserActivity { stop() { document.onmousemove = undefined; document.onkeypress = undefined; - window.removeEventListener('scroll', this._onUserActivity.bind(this), true); + window.removeEventListener('wheel', this._onUserActivity.bind(this), true); } _onUserActivity(event) { - if (event.screenX) { + if (event.screenX && event.type == "mousemove") { if (event.screenX === this.lastScreenX && event.screenY === this.lastScreenY) {