diff --git a/lyra/web/static/index.html b/lyra/web/static/index.html
index b1711fb..d7f48b5 100644
--- a/lyra/web/static/index.html
+++ b/lyra/web/static/index.html
@@ -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", () => {
diff --git a/lyra/web/static/style.css b/lyra/web/static/style.css
index c3f3f6a..b2fad9d 100644
--- a/lyra/web/static/style.css
+++ b/lyra/web/static/style.css
@@ -56,6 +56,10 @@ body.dark {
html {
overscroll-behavior: none;
+ /* Stop iOS from inflating font sizes when the device rotates to landscape (and
+ leaving them big on rotate back). Every other page sets this; the chat didn't. */
+ -webkit-text-size-adjust: 100%;
+ text-size-adjust: 100%;
}
body {