FIX: fixed a bug where keyboard on ios was broken (#25338)
It was broken on iOS PWA, when you had the keyboard open and would leave the app. When you came back the body was scrolled and it was looking buggy until you close/reopen keyboard. This commit attempt to reposition the page correctly 200ms after the tab is visible again.
This commit is contained in:
parent
07a0c6c637
commit
a840c295d8
|
@ -184,6 +184,7 @@ export default class ChatChannel extends Component {
|
|||
onPresenceChangeCallback(present) {
|
||||
if (present) {
|
||||
this.debouncedUpdateLastReadMessage();
|
||||
bodyScrollFix({ delayed: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 viewport
|
||||
if (
|
||||
|
@ -42,6 +42,12 @@ export function bodyScrollFix() {
|
|||
document.documentElement.classList.contains("keyboard-visible") &&
|
||||
!isZoomed()
|
||||
) {
|
||||
if (options.delayed) {
|
||||
setTimeout(() => {
|
||||
document.documentElement.scrollTo(0, 0);
|
||||
}, 200);
|
||||
} else {
|
||||
document.documentElement.scrollTo(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue