A platform for community discussion. Free, open, simple.
FIX: fixed a bug where keyboard on ios was broken (#25338)
Joffrey JAFFEUXa840c295d87f
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjsindex c1f94cc1ef5..87eddf7955f 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs@@ -184,6 +184,7 @@ export default class ChatChannel extends Component {onPresenceChangeCallback(present) {if (present) {this.debouncedUpdateLastReadMessage();+ bodyScrollFix({ delayed: true });}}diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-ios-hacks.js b/plugins/chat/assets/javascripts/discourse/lib/chat-ios-hacks.jsindex 74e2bd4085e..90036d4f6c6 100644--- a/plugins/chat/assets/javascripts/discourse/lib/chat-ios-hacks.js+++ b/plugins/chat/assets/javascripts/discourse/lib/chat-ios-hacks.js@@ -34,7 +34,7 @@ export function stackingContextFix(scrollable, callback) {}}-export function bodyScrollFix() {+export function bodyScrollFix(options = {}) {// when keyboard is visible this will ensure body// doesn’t scroll out of viewportif (@@ -42,6 +42,12 @@ export function bodyScrollFix() {document.documentElement.classList.contains("keyboard-visible") &&!isZoomed()) {- document.documentElement.scrollTo(0, 0);+ if (options.delayed) {+ setTimeout(() => {+ document.documentElement.scrollTo(0, 0);+ }, 200);+ } else {+ document.documentElement.scrollTo(0, 0);+ }}}