From c3cbff55be527a95b016b6057fa04dbf8804dbcc Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Mon, 11 Feb 2019 20:56:25 -0800 Subject: [PATCH] FIX: only respond to menu open swipes on Andorid --- .../discourse/components/site-header.js.es6 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/components/site-header.js.es6 b/app/assets/javascripts/discourse/components/site-header.js.es6 index 85913e6a710..8d126c202be 100644 --- a/app/assets/javascripts/discourse/components/site-header.js.es6 +++ b/app/assets/javascripts/discourse/components/site-header.js.es6 @@ -228,6 +228,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, { didInsertElement() { this._super(...arguments); + const { isAndroid } = this.capabilities; $(window).on("resize.discourse-menu-panel", () => this.afterRender()); this.appEvents.on("header:show-topic", topic => this.setTopic(topic)); @@ -244,11 +245,16 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, { } }); - this.addTouchListeners($("body")); + // Only add listeners for opening menus by swiping them in on Android devices + // iOS will respond to these events, but also does swiping for back/forward + if (isAndroid) { + this.addTouchListeners($("body")); + } }, willDestroyElement() { this._super(...arguments); + const { isAndroid } = this.capabilities; $("body").off("keydown.header"); $(window).off("resize.discourse-menu-panel"); @@ -256,7 +262,9 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, { this.appEvents.off("header:hide-topic"); this.appEvents.off("dom:clean"); - this.removeTouchListeners($("body")); + if (isAndroid) { + this.removeTouchListeners($("body")); + } Ember.run.cancel(this._scheduledRemoveAnimate); window.cancelAnimationFrame(this._scheduledMovingAnimation);