Skip to content

constrain and make chat questions scrollable#298786

Merged
meganrogge merged 5 commits intomainfrom
merogge/fix-height-scrollable
Mar 3, 2026
Merged

constrain and make chat questions scrollable#298786
meganrogge merged 5 commits intomainfrom
merogge/fix-height-scrollable

Conversation

@meganrogge
Copy link
Collaborator

@meganrogge meganrogge commented Mar 2, 2026

fixes #298287

Makes the chat question carousel scrollable — wraps the input area in a DomScrollableElement with a max-height so long option lists scroll instead of pushing the chat UI off-screen. A ResizeObserver keeps the scroll layout in sync.

question-scroll.mov

Copilot AI review requested due to automatic review settings March 2, 2026 19:44
@meganrogge meganrogge self-assigned this Mar 2, 2026
@meganrogge meganrogge requested review from justschen and roblourens and removed request for Copilot March 2, 2026 19:45
@meganrogge meganrogge added this to the March 2026 milestone Mar 2, 2026
@meganrogge meganrogge enabled auto-merge (squash) March 2, 2026 19:45
@meganrogge meganrogge marked this pull request as draft March 3, 2026 00:08
auto-merge was automatically disabled March 3, 2026 00:08

Pull request was converted to draft

Copilot AI review requested due to automatic review settings March 3, 2026 00:14
@meganrogge meganrogge marked this pull request as ready for review March 3, 2026 00:15
@meganrogge meganrogge marked this pull request as draft March 3, 2026 00:16
@meganrogge meganrogge marked this pull request as ready for review March 3, 2026 00:19
Copy link
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

Constrain the chat question carousel so long questions/option lists don’t expand beyond the chat widget, and make the question input area internally scrollable (fixes #298287).

Changes:

  • Prevent forwarding mouse-wheel events to the chat list when the wheel event originates inside the chat widget container.
  • Add CSS constraints (max-height + flex adjustments) to cap the question carousel height and enable internal scrolling layout.
  • Wrap the question input container in a DomScrollableElement and dynamically size its viewport to the available space.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts Refines wheel event forwarding to avoid interfering with normal in-widget scrolling.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css Adds max-height constraints and flex rules needed for a scrollable question UI.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.ts Implements a scrollable wrapper around question inputs and calculates available scroll height.

border: 1px solid var(--vscode-input-border, transparent);
background-color: var(--vscode-editor-background);
border-radius: 4px;
max-height: min(420px, 45vh);
Copy link
Member

Choose a reason for hiding this comment

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

How does this fix it? Isn't vh relative to the window?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is. This is only an upper bound for the carousel size (so it doesn’t grow too tall). The actual scroll viewport calculation no longer uses window.innerHeight; it uses this._questionContainer.clientHeight (the resolved layout size in context), so behavior tracks the real available space in the chat UI.

// Constrain the content element (DomScrollableElement._element) so that
// scanDomNode sees clientHeight < scrollHeight and enables scrolling.
// The wrapper inherits the same constraint via CSS flex.
scrollableContent.style.height = `${constrainedScrollableHeight}px`;
Copy link
Member

Choose a reason for hiding this comment

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

I still don't really understand why this is necessary. Seems like scanDomNode is meant to measure things for you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

scanDomNode is measure-only; we still need the measured element (inputContainer) to be height-bounded. Otherwise it can auto-grow with content and not report overflow. Setting scrollableContent.style.height is one way to enforce that bound.

@meganrogge meganrogge enabled auto-merge (squash) March 3, 2026 18:12
roblourens
roblourens previously approved these changes Mar 3, 2026
@meganrogge meganrogge merged commit e848b20 into main Mar 3, 2026
21 checks passed
@meganrogge meganrogge deleted the merogge/fix-height-scrollable branch March 3, 2026 23:10
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.

question exceeds chat window size

4 participants