Skip to content

fix(chat): truncate suggested prompt titles to prevent overflow in narrow chat (fixes #275257) - #345436

Merged
Justin Chen (justschen) merged 4 commits into
microsoft:mainfrom
sumit-2007-git:fix/chat-suggested-prompt-button-overflow
Nov 4, 2026
Merged

Justin Chen (justschen) merged 4 commits into
microsoft:mainfrom
sumit-2007-git:fix/chat-suggested-prompt-button-overflow

Conversation

@sumit-2007-git

Copy link
Copy Markdown
Contributor

Description

Fixes #275257.

Problem

When the chat panel is resized to a narrow width and suggested prompt / handoff titles are long, the text string overflows outside the button element boundary.

Root Cause

  1. In src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css, .chat-welcome-view-suggested-prompt-title used white-space: nowrap without overflow: hidden, text-overflow: ellipsis, or min-width: 0.
  2. The button .chat-welcome-view-suggested-prompt lacked a max-width: 100% constraint, causing the text to spill out past the button border on narrow viewports.

Solution

  1. In chatViewWelcome.css:
    • Added max-width: 100% to .chat-welcome-view-suggested-prompt.
    • Added overflow: hidden, text-overflow: ellipsis, and min-width: 0 to .chat-welcome-view-suggested-prompt-title.
  2. In chatSuggestNextWidget.ts:
    • Set titleElement.title to the label so users can hover to view the complete text when truncated.

Copilot AI balanced review requested due to automatic review settings November 1, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Native title tooltips on the buttons and Autopilot label bypass workbench theming and the configured hover delay, leaving an unresolved consistency issue.

1 open issue
What changed in this PR

Addresses #275257 by keeping long suggested-prompt and handoff titles within their buttons when the chat panel is narrow.

Changes:

  • Limits button width and enables ellipsis truncation for titles.
  • Adds native tooltips to expose full handoff and Autopilot labels.
File Description
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​media/​chatViewWelcome.css Constrains button width and truncates overflowing titles.
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​chatContentParts/​chatSuggestNextWidget.ts Adds full-label tooltips to handoff and Autopilot titles.

Review effort: Balanced


const titleElement = dom.append(button, dom.$('.chat-welcome-view-suggested-prompt-title'));
titleElement.textContent = handoff.label;
titleElement.title = handoff.label;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated to inject \IHoverService\ and register \setupDelayedHover\ with \HoverStyle.Pointer\ in \disposables\ for both handoff prompt buttons and the Autopilot button, removing the native DOM \ itle.

@sumit-2007-git

Copy link
Copy Markdown
Contributor Author

Hi Justin Chen (@justschen), gentle follow-up on this PR whenever convenient. All CI checks are green, and the suggested-prompt button overflow adjustments are ready for review. Happy to make any updates if needed. Thank you!

@justschen Justin Chen (justschen) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is fine, thanks!

keep in mind this is a widget that only appears in the local harness which is getting deprecated soon

@justschen
Justin Chen (justschen) enabled auto-merge (squash) November 4, 2026 16:25
@justschen
Justin Chen (justschen) merged commit c2bb814 into microsoft:main Nov 4, 2026
59 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 4, 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.

text overflows button container

5 participants