fine-tune scroll lock on ios

reserveScrollBarGap and allow scrolling items inside composer
This commit is contained in:
Penar Musaraj 2024-12-12 19:38:17 -05:00
parent d6ed5e498b
commit 957ed36663
1 changed files with 12 additions and 11 deletions

View File

@ -134,20 +134,21 @@ export default class DVirtualHeight extends Component {
this.appEvents.trigger("keyboard-visibility-change", keyboardVisible); this.appEvents.trigger("keyboard-visibility-change", keyboardVisible);
if (keyboardVisible) { // disable body scroll in mobile composer
docEl.classList.add("keyboard-visible"); // we have to do this because we're positioning the composer with
// position: fixed and top: 0 and scrolling would move the composer halfway out of the viewport
// disable body scroll in mobile composer // we can't use bottom: 0, it is very unreliable with keyboard visible
// we have to do this because we're positioning the composer with if (docEl.classList.contains("composer-open")) {
// position: fixed and top: 0 and scrolling would move the composer halfway out of the viewport disableBodyScroll(document.querySelector("#reply-control"), {
// we can't use bottom: 0, it is very unreliable with keyboard visible reserveScrollBarGap: true,
if (docEl.classList.contains("composer-open")) { allowTouchMove: (el) => el.closest("#reply-control"),
disableBodyScroll(document.querySelector("#reply-control")); });
}
} }
keyboardVisible
? docEl.classList.add("keyboard-visible")
: docEl.classList.remove("keyboard-visible");
if (!keyboardVisible) { if (!keyboardVisible) {
docEl.classList.remove("keyboard-visible");
clearAllBodyScrollLocks(); clearAllBodyScrollLocks();
} }
} }