don't allow expanding until hitting max height in thinking (#299249)

* don't allow expanding until hitting max height in thinking

* Address comments
This commit is contained in:
Justin Chen
2026-03-04 13:44:18 -08:00
committed by GitHub
parent d405135f71
commit 49b4ea3cf6

View File

@@ -500,6 +500,10 @@ export class ChatThinkingContentPart extends ChatCollapsibleContentPart implemen
height: viewportHeight,
scrollHeight: contentHeight
});
// Re-evaluate hover feedback as content grows past the max height,
// reusing the already-measured contentHeight to avoid an extra layout read.
this.updateDropdownClickability(contentHeight);
}
private scrollToBottom(): void {
@@ -651,8 +655,17 @@ export class ChatThinkingContentPart extends ChatCollapsibleContentPart implemen
return !(!strippedContent || strippedContent === titleToCompare);
}
private updateDropdownClickability(): void {
const allowExpansion = this.shouldAllowExpansion();
private updateDropdownClickability(knownContentHeight?: number): void {
let allowExpansion = this.shouldAllowExpansion();
// don't allow feedback on fixed scrolling before reaching max height.
if (allowExpansion && this.fixedScrollingMode && !this.streamingCompleted && !this.element.isComplete && this.wrapper) {
const contentHeight = knownContentHeight ?? this.wrapper.scrollHeight;
if (contentHeight <= THINKING_SCROLL_MAX_HEIGHT) {
allowExpansion = false;
}
}
if (!allowExpansion && this.isExpanded()) {
this.setExpanded(false);
}