diff --git a/ui/src/components/IssueChatThread.test.tsx b/ui/src/components/IssueChatThread.test.tsx
index 890a9405170..dbddfacb3da 100644
--- a/ui/src/components/IssueChatThread.test.tsx
+++ b/ui/src/components/IssueChatThread.test.tsx
@@ -518,7 +518,59 @@ describe("IssueChatThread", () => {
});
});
- it("requests composer viewport restoration when live messages arrive while the composer is visible", () => {
+ it("does not restore the composer viewport for passive live updates by default", () => {
+ const root = createRoot(container);
+
+ act(() => {
+ root.render(
+
+ {}}
+ enableLiveTranscriptPolling={false}
+ />
+ ,
+ );
+ });
+
+ act(() => {
+ root.render(
+
+ {}}
+ enableLiveTranscriptPolling={false}
+ />
+ ,
+ );
+ });
+
+ expect(restoreComposerViewportSnapshotMock).not.toHaveBeenCalled();
+
+ act(() => {
+ root.unmount();
+ });
+ });
+
+ it("requests composer viewport restoration when live messages arrive during active composer interaction", () => {
const root = createRoot(container);
const scrollByMock = vi.spyOn(window, "scrollBy").mockImplementation(() => {});
shouldPreserveComposerViewportMock.mockReturnValue(true);
diff --git a/ui/src/lib/issue-chat-scroll.test.ts b/ui/src/lib/issue-chat-scroll.test.ts
index 3621aaec754..491369ad59b 100644
--- a/ui/src/lib/issue-chat-scroll.test.ts
+++ b/ui/src/lib/issue-chat-scroll.test.ts
@@ -72,12 +72,12 @@ describe("issue-chat-scroll", () => {
mainContent.remove();
});
- it("preserves the composer viewport when the composer is visible", () => {
+ it("does not preserve the composer viewport just because the composer is visible", () => {
const composer = document.createElement("div");
document.body.appendChild(composer);
mockTop(composer, 540);
- expect(shouldPreserveComposerViewport(composer)).toBe(true);
+ expect(shouldPreserveComposerViewport(composer)).toBe(false);
composer.remove();
});
diff --git a/ui/src/lib/issue-chat-scroll.ts b/ui/src/lib/issue-chat-scroll.ts
index 1e7e5da135a..b70f3d925e2 100644
--- a/ui/src/lib/issue-chat-scroll.ts
+++ b/ui/src/lib/issue-chat-scroll.ts
@@ -46,10 +46,7 @@ export function shouldPreserveComposerViewport(
if (activeElement instanceof Node && composerElement.contains(activeElement)) {
return true;
}
-
- const viewportHeight = doc.defaultView?.innerHeight ?? window.innerHeight;
- const rect = composerElement.getBoundingClientRect();
- return rect.bottom > 0 && rect.top < viewportHeight;
+ return false;
}
export function restoreComposerViewportSnapshot(