Skip to content

sessions: scope chat "card style" to chat panel and chat editor only#318712

Merged
ulugbekna merged 1 commit into
mainfrom
ulugbekna/agents/inline-chat-terminal-alignment-fix
May 28, 2026
Merged

sessions: scope chat "card style" to chat panel and chat editor only#318712
ulugbekna merged 1 commit into
mainfrom
ulugbekna/agents/inline-chat-terminal-alignment-fix

Conversation

@ulugbekna
Copy link
Copy Markdown
Contributor

@ulugbekna ulugbekna commented May 28, 2026

Problem

In the Agents window, the terminal inline chat (Ctrl/Cmd+I in the terminal) was visually broken: chat content boxes were shifted right with a large empty area on the left and the right side overflowed past the terminal panel.

Root cause: three rules in sessions/browser/media/style.css targeted .agent-sessions-workbench .interactive-session ... (selectors .interactive-item-container, > .chat-suggest-next-widget, and .interactive-input-part) and applied a 950px-wide centered "card" layout. These rules were intended for the chat panel and chat editor surfaces, but they also matched every other chat surface that reuses the chat widget components — notably:

  1. The terminal inline chat (visible bug in the screenshot).
  2. The editor inline chat (Ctrl/Cmd+I in any editor open in the Agents window — the Agents window has a fully functional editor area).
  3. The agent-session hover widget (padding: 0 was being silently overridden by the rule's !important 12px padding).

Before

CleanShot 2026-05-28 at 14 18 06@2x

After

CleanShot 2026-05-28 at 14 17 43@2x

Fix

Narrow the three rules at the source to only target .part.sessionspart (chat panel — sessionsPart.ts:109) and .chat-editor-relative (chat editor host — chatEditor.ts:97).

Also dropped the now-unnecessary !important markers on padding/margin/display: with the narrowed scope there are no competing rules at the targeted selectors, so the markers were already redundant. (The !important on background-color: transparent for the inner monaco-editor inside .interactive-input-part is unchanged — that one really does need to override the editor's own background.)

Verification

Verified via CDP-injected test DOM against the running Agents window. Computed styles after the fix:

Surface max-width margin Outcome
.part.sessionspart (chat panel) 950px auto-centered card layout preserved
.chat-editor-relative (chat editor) 950px auto-centered card layout preserved
.terminal-inline-chat (terminal inline chat) none 0 fixed
.zone-widget.inline-chat-widget (editor inline chat) none 0 fixed
.agent-session-hover (hover widget) none 0 fixed

Notes for reviewers

  • This was originally going to live as a defensive override in workbench/contrib/terminalContrib/chat/browser/media/terminalChatWidget.css, but two subagent reviewers flagged it as wrong-layer (inverts the workbench → sessions dependency) and as fixing only the symptom (the editor inline chat and hover widget have the same leak). Moving the fix to the source addresses all three surfaces in one change.
  • The mobile/phone-layout rules at mobileChatShell.css:248-256 already use !important to re-relax max-width on phone — those still work because phone's .phone-layout selectors have equal or higher specificity than the (now narrower) source rules.
  • Items within the input box are not vertically centered but that's outside the scope of this repo

The rules at `.agent-sessions-workbench .interactive-session
.interactive-item-container`, `> .chat-suggest-next-widget`, and
`.interactive-input-part` used to apply to every chat surface inside the
Agents window. That includes surfaces that reuse the chat widget
components but do not want the 950px-wide centered "card" layout
notably the terminal inline chat (Ctrl/Cmd+I in terminal), the editor
inline chat (Ctrl/Cmd+I in an editor), and the agent-session hover
widget. In those surfaces the items got centered with a 950px max-width
which left empty space on the left and overflowed on the right.

Scope the three rules to `.part.sessionspart` and `.chat-editor-relative`,
the two surfaces that actually want the card layout. With the narrowed
needed (no competing rules at the target selectors) and have been
removed.

Verified via CDP-injected test DOM against the running Agents window:

- `.part.sessionspart` -> max-width 950px, auto-centered (preserved)
- `.chat-editor-relative` -> max-width 950px, auto-centered (preserved)
- `.terminal-inline-chat` -> max-width none, margin 0 (fixed)
- `.zone-widget.inline-chat-widget` -> max-width none, margin 0 (fixed)
- `.agent-session-hover` -> max-width none, margin 0 (fixed)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR narrows three chat layout CSS rules in the Agents window stylesheet so the 950px "card style" only applies to the chat panel and chat editor host, instead of leaking into every chat surface (terminal inline chat, editor inline chat, agent-session hover widget) that reuses the shared chat widget classes.

Changes:

  • Scope .interactive-item-container and .chat-suggest-next-widget card rules to .part.sessionspart and .chat-editor-relative.
  • Scope .interactive-input-part card rule the same way, also fixing the terminal inline chat layout bug.
  • Drop now-unneeded !important markers on padding/margin/display since the narrowed selectors no longer compete with other rules (keeping !important only on the editor-background transparency rule).
Show a summary per file
File Description
src/vs/sessions/browser/media/style.css Narrow three card-layout rules to chat panel / chat editor host selectors and remove redundant !important markers.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@ulugbekna ulugbekna merged commit db8b674 into main May 28, 2026
40 of 41 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/agents/inline-chat-terminal-alignment-fix branch May 28, 2026 17:24
@vs-code-engineering vs-code-engineering Bot added this to the 1.123.0 milestone May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants