From bf79586d86383ea6686be44f57c717e23d769ae0 Mon Sep 17 00:00:00 2001 From: Tyson Thomas Date: Thu, 27 Nov 2025 08:19:24 -0800 Subject: [PATCH] wip: shadow dom fix --- .../ai_chat/ui/AgentSessionHeaderComponent.ts | 6 +- front_end/panels/ai_chat/ui/ChatView.ts | 13 ++-- .../ai_chat/ui/ConversationHistoryList.ts | 6 +- .../panels/ai_chat/ui/FileListDisplay.ts | 6 +- .../ai_chat/ui/LiveAgentSessionComponent.ts | 7 +- .../panels/ai_chat/ui/PromptEditDialog.ts | 53 +++++++++++--- .../panels/ai_chat/ui/TodoListDisplay.ts | 6 +- .../panels/ai_chat/ui/message/MessageList.ts | 69 ++++++++++--------- .../ai_chat/ui/version/VersionBanner.ts | 6 +- front_end/ui/legacy/GlassPane.ts | 2 +- 10 files changed, 116 insertions(+), 58 deletions(-) diff --git a/front_end/panels/ai_chat/ui/AgentSessionHeaderComponent.ts b/front_end/panels/ai_chat/ui/AgentSessionHeaderComponent.ts index a07150ddbb..f3cdd4b83a 100644 --- a/front_end/panels/ai_chat/ui/AgentSessionHeaderComponent.ts +++ b/front_end/panels/ai_chat/ui/AgentSessionHeaderComponent.ts @@ -14,7 +14,9 @@ export type SessionStatus = 'running' | 'completed' | 'error'; @customElement('agent-session-header') export class AgentSessionHeaderComponent extends HTMLElement { static readonly litTagName = Lit.StaticHtml.literal`agent-session-header`; - private readonly shadow = this.attachShadow({mode: 'open'}); + // Use Light DOM + // private readonly shadow = this.attachShadow({mode: 'open'}); + private readonly shadow = this; private session: AgentSession | null = null; private isExpanded = true; @@ -80,7 +82,7 @@ export class AgentSessionHeaderComponent extends HTMLElement { Lit.render(html` `; + // Build a set of nested child session IDs present in the current message set. // Include both nestedSessions[].sessionId and any handoff anchors in messages that // have a concrete nestedSessionId (ignore pending-* placeholders). Also build @@ -865,6 +866,7 @@ export class ChatView extends HTMLElement { const suggestions = this.#renderExampleSuggestions(); Lit.render(html` + ${stylesTemplate}
${this.#renderVersionBanner()}
@@ -886,6 +888,7 @@ export class ChatView extends HTMLElement { } else { // Render normal expanded view for conversation Lit.render(html` + ${stylesTemplate}
${this.#renderVersionBanner()} diff --git a/front_end/panels/ai_chat/ui/ConversationHistoryList.ts b/front_end/panels/ai_chat/ui/ConversationHistoryList.ts index e50098ab0b..962c0b9d49 100644 --- a/front_end/panels/ai_chat/ui/ConversationHistoryList.ts +++ b/front_end/panels/ai_chat/ui/ConversationHistoryList.ts @@ -18,7 +18,9 @@ const {unsafeHTML} = Directives; */ export class ConversationHistoryList extends HTMLElement { static readonly litTagName = Lit.StaticHtml.literal`ai-conversation-history-list`; - readonly #shadow = this.attachShadow({mode: 'open'}); + // Use Light DOM + // readonly #shadow = this.attachShadow({mode: 'open'}); + readonly #shadow = this; readonly #boundRender = this.#render.bind(this); #conversations: ConversationMetadata[] = []; @@ -119,7 +121,7 @@ export class ConversationHistoryList extends HTMLElement { Lit.render( html`
diff --git a/front_end/panels/ai_chat/ui/FileListDisplay.ts b/front_end/panels/ai_chat/ui/FileListDisplay.ts index 84701931d0..21cbdd5aaf 100644 --- a/front_end/panels/ai_chat/ui/FileListDisplay.ts +++ b/front_end/panels/ai_chat/ui/FileListDisplay.ts @@ -17,7 +17,9 @@ const {html, nothing} = Lit; */ export class FileListDisplay extends HTMLElement { static readonly litTagName = Lit.StaticHtml.literal`ai-file-list-display`; - readonly #shadow = this.attachShadow({mode: 'open'}); + // Use Light DOM + // readonly #shadow = this.attachShadow({mode: 'open'}); + readonly #shadow = this; readonly #boundRender = this.#render.bind(this); #files: FileSummary[] = []; @@ -212,7 +214,7 @@ export class FileListDisplay extends HTMLElement { Lit.render(html` -
- -
- `, this.#shadow, {host: this}); + ai-message-list::-webkit-scrollbar { width: 4px; } + ai-message-list::-webkit-scrollbar-track { background: transparent; } + ai-message-list::-webkit-scrollbar-thumb { background-color: var(--color-scrollbar); border-radius: 4px; } + `; + this.prepend(style); + } } } diff --git a/front_end/panels/ai_chat/ui/version/VersionBanner.ts b/front_end/panels/ai_chat/ui/version/VersionBanner.ts index 52bf18a2d1..e025f989dd 100644 --- a/front_end/panels/ai_chat/ui/version/VersionBanner.ts +++ b/front_end/panels/ai_chat/ui/version/VersionBanner.ts @@ -12,7 +12,9 @@ export interface VersionInfo { latestVersion: string; releaseUrl: string; isUpda @customElement('ai-version-banner') export class VersionBanner extends HTMLElement { static readonly litTagName = Lit.StaticHtml.literal`ai-version-banner`; - readonly #shadow = this.attachShadow({mode: 'open'}); + // Use Light DOM + // readonly #shadow = this.attachShadow({mode: 'open'}); + readonly #shadow = this; // Manual properties #info: VersionInfo | null = null; @@ -32,7 +34,7 @@ export class VersionBanner extends HTMLElement { const info = this.#info; Lit.render(html`