diff --git a/app/assets/javascripts/discourse/components/composer-body.js.es6 b/app/assets/javascripts/discourse/components/composer-body.js.es6 index b1af547ebb2..99cf7b65f48 100644 --- a/app/assets/javascripts/discourse/components/composer-body.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-body.js.es6 @@ -132,12 +132,16 @@ export default Ember.Component.extend(KeyEnterEscape, { $document.on(END_EVENTS, endDrag); }); - if (window.visualViewport !== undefined) { + if (this.shouldUseVisualViewportListener()) { this.viewportResize(); window.visualViewport.addEventListener("resize", this.viewportResize); } }, + shouldUseVisualViewportListener() { + return this.capabilities.isIOS && window.visualViewport !== undefined; + }, + viewportResize() { const composerVH = window.visualViewport.height * 0.01; @@ -174,7 +178,7 @@ export default Ember.Component.extend(KeyEnterEscape, { willDestroyElement() { this._super(...arguments); this.appEvents.off("composer:resize", this, this.resize); - if (window.visualViewport !== undefined) { + if (this.shouldUseVisualViewportListener()) { window.visualViewport.removeEventListener("resize", this.viewportResize); } },