fix: phone app view zoom corrects
This commit is contained in:
@@ -701,6 +701,16 @@
|
||||
window.addEventListener("resize", nudgeAppHeight);
|
||||
window.addEventListener("orientationchange", nudgeAppHeight);
|
||||
|
||||
// A rotation reflows the chat and iOS drops the scroll to mid-history. If we
|
||||
// were pinned to the latest message, snap back there once the layout settles
|
||||
// (re-fire across the reflow since iOS reports stale dimensions mid-rotate).
|
||||
window.addEventListener("orientationchange", () => {
|
||||
const m = document.getElementById("messages");
|
||||
const wasAtBottom = m.scrollHeight - m.scrollTop - m.clientHeight < 90;
|
||||
if (!wasAtBottom) return; // respect the user's scroll-up position
|
||||
[100, 300, 600].forEach((t) => setTimeout(() => { m.scrollTop = m.scrollHeight; }, t));
|
||||
});
|
||||
|
||||
// Keep the latest message in view when the keyboard opens/closes.
|
||||
const userInputEl = document.getElementById("userInput");
|
||||
userInputEl.addEventListener("focus", () => {
|
||||
|
||||
Reference in New Issue
Block a user