diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-vh.js b/plugins/chat/assets/javascripts/discourse/components/chat-vh.js index 270e4a3bc95..e8decbf86a6 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-vh.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-vh.js @@ -11,18 +11,20 @@ export default class ChatVh extends Component { didInsertElement() { this._super(...arguments); - this.setVHFromVisualViewPort(); - - (window?.visualViewport || window).addEventListener( - "resize", - this.setVHFromVisualViewPort - ); - if ("virtualKeyboard" in navigator) { + this.setVHFromKeyboard(); + navigator.virtualKeyboard.addEventListener( "geometrychange", this.setVHFromKeyboard ); + } else { + this.setVHFromVisualViewPort(); + + (window?.visualViewport || window).addEventListener( + "resize", + this.setVHFromVisualViewPort + ); } }