diff --git a/web/src/lib/keyboard-inset.test.ts b/web/src/lib/keyboard-inset.test.ts index 8219ff4dfc..de4f0c6abb 100644 --- a/web/src/lib/keyboard-inset.test.ts +++ b/web/src/lib/keyboard-inset.test.ts @@ -3,7 +3,6 @@ import { computeKeyboardInset, keyboardRevealScrollDelta, KEYBOARD_INSET_MIN_PX, - shouldPinScroll, } from "./keyboard-inset"; describe("computeKeyboardInset", () => { @@ -69,23 +68,7 @@ describe("computeKeyboardInset", () => { }); }); -describe("shouldPinScroll", () => { - it("pins while a keyboard inset is active", () => { - expect(shouldPinScroll(320)).toBe(true); - }); - - it("does not pin without a keyboard", () => { - expect(shouldPinScroll(0)).toBe(false); - }); -}); - describe("keyboardRevealScrollDelta", () => { - it("scrolls the page so the composer sits on the visual-viewport bottom", () => { - expect( - keyboardRevealScrollDelta(800, { height: 480, offsetTop: 0 }), - ).toBe(320); - }); - it("accounts for iOS visual-viewport offsetTop", () => { expect( keyboardRevealScrollDelta(800, { height: 480, offsetTop: 40 }), @@ -97,10 +80,4 @@ describe("keyboardRevealScrollDelta", () => { keyboardRevealScrollDelta(480, { height: 480, offsetTop: 0 }), ).toBe(0); }); - - it("returns 0 for non-finite geometry", () => { - expect( - keyboardRevealScrollDelta(NaN, { height: 480, offsetTop: 0 }), - ).toBe(0); - }); }); diff --git a/web/src/lib/keyboard-inset.ts b/web/src/lib/keyboard-inset.ts index 7592ef5f43..8b3138e73c 100644 --- a/web/src/lib/keyboard-inset.ts +++ b/web/src/lib/keyboard-inset.ts @@ -57,19 +57,6 @@ export function computeKeyboardInset( return inset >= KEYBOARD_INSET_MIN_PX ? inset : 0; } -/** - * Whether the page scroll should be pinned back to the top. - * - * The dashboard shell is a fixed `h-dvh` column and must never scroll, but - * iOS Safari auto-scrolls the *page* when a focused input would sit under - * the keyboard (xterm's hidden textarea triggers this). Pin whenever a - * keyboard is present so the terminal chrome stays put; the terminal's own - * scrollback handles content visibility. - */ -export function shouldPinScroll(nextInsetPx: number): boolean { - return nextInsetPx > 0; -} - /** Pixels to `window.scrollBy` so the composer (xterm host bottom) sits on * the visible bottom of the visual viewport — just above the keyboard. * Pinning the page to (0, 0) fights iOS and can leave the input line off-screen. */ diff --git a/web/src/pages/ChatPage.tsx b/web/src/pages/ChatPage.tsx index 721bd88811..3deb64c7e2 100644 --- a/web/src/pages/ChatPage.tsx +++ b/web/src/pages/ChatPage.tsx @@ -1597,7 +1597,7 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) { // NS-434 follow-up: attach the visualViewport keyboard-inset listeners // ONLY while the chat tab is actually visible. ChatPage stays mounted // (display:none) on every other dashboard route, so unconditional - // listeners made the scroll pin (`window.scrollTo(0, 0)`) fire whenever a + // listeners made the composer reveal (`window.scrollBy`) fire whenever a // soft keyboard opened on Settings/Sessions/etc., fighting iOS Safari's // own scroll-into-view for the focused input there. The handlers read // through refs populated by the main PTY effect, so attach/detach here is