From 09ff362cf4c2edac76f002da74da4966ae4cdc96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0=C4=87eki=C4=87?= Date: Thu, 5 Mar 2026 12:50:28 +0100 Subject: [PATCH] fix: prevent permission prompts from interrupting auto-scroll (#6621) Stop inline permission/question clicks from bubbling up to the message list's handleInteraction (which disables auto-scroll), and resume auto-scroll when bottom-dock prompts disappear during an active session. --- .../src/components/chat/AssistantMessage.tsx | 2 +- .../webview-ui/src/components/chat/ChatView.tsx | 13 ++++++++++++- .../webview-ui/src/components/chat/MessageList.tsx | 7 ++++++- .../webview-ui/src/components/chat/QuestionDock.tsx | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/kilo-vscode/webview-ui/src/components/chat/AssistantMessage.tsx b/packages/kilo-vscode/webview-ui/src/components/chat/AssistantMessage.tsx index 498820e91d4..ca7ee8d5c34 100644 --- a/packages/kilo-vscode/webview-ui/src/components/chat/AssistantMessage.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/chat/AssistantMessage.tsx @@ -87,7 +87,7 @@ export const AssistantMessage: Component = (props) => { /> {(p) => ( -
+
e.stopPropagation()}> 0}>
diff --git a/packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx b/packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx index bbbd1378261..b5be42e3c01 100644 --- a/packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx @@ -3,7 +3,7 @@ * Main chat container that combines all chat components */ -import { Component, For, Show, createSignal, onCleanup, onMount } from "solid-js" +import { Component, For, Show, createSignal, createEffect, on, onCleanup, onMount } from "solid-js" import { Button } from "@kilocode/kilo-ui/button" import { BasicTool } from "@kilocode/kilo-ui/basic-tool" import { TaskHeader } from "./TaskHeader" @@ -32,6 +32,17 @@ export const ChatView: Component = (props) => { const permissionRequest = () => sessionPermissions().find((p) => !p.tool) const blocked = () => sessionPermissions().length > 0 || sessionQuestions().length > 0 + // When a bottom-dock permission/question disappears while the session is busy, + // the scroll container grows taller. Dispatch a custom event so MessageList can + // resume auto-scroll. + createEffect( + on(blocked, (isBlocked, wasBlocked) => { + if (wasBlocked && !isBlocked && !idle()) { + window.dispatchEvent(new CustomEvent("resumeAutoScroll")) + } + }), + ) + const [responding, setResponding] = createSignal(false) onMount(() => { diff --git a/packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx b/packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx index 98ddfe8d5af..6764da91916 100644 --- a/packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx @@ -7,7 +7,7 @@ * Shows recent sessions in the empty state for quick resumption. */ -import { Component, For, Show, createEffect, createMemo, JSX } from "solid-js" +import { Component, For, Show, createEffect, createMemo, onCleanup, JSX } from "solid-js" import { Spinner } from "@kilocode/kilo-ui/spinner" import { Button } from "@kilocode/kilo-ui/button" import { useDialog } from "@kilocode/kilo-ui/context/dialog" @@ -48,6 +48,11 @@ export const MessageList: Component = (props) => { overflowAnchor: "dynamic", }) + // Resume auto-scroll when a bottom-dock permission/question is dismissed + const onResumeAutoScroll = () => autoScroll.resume() + window.addEventListener("resumeAutoScroll", onResumeAutoScroll) + onCleanup(() => window.removeEventListener("resumeAutoScroll", onResumeAutoScroll)) + let loaded = false createEffect(() => { if (!loaded && server.isConnected() && session.sessions().length === 0) { diff --git a/packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx b/packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx index bb8abd929b7..a03a77c1eb6 100644 --- a/packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/chat/QuestionDock.tsx @@ -148,7 +148,7 @@ export const QuestionDock: Component<{ request: QuestionRequest }> = (props) => } return ( -
+
e.stopPropagation()}>