Skip to content

A platform for community discussion. Free, open, simple.

FIX: rely only on one keyboard computation solution (#21492)

Joffrey JAFFEUX5b12d23b1dfe
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
+ );
}
}