Skip to content

Commit 1417ec8

Browse files
authored
show confirmation message + better tabbing (microsoft#250308)
* make sure to not hide header when confirmation message * fix tab index and outline in chat with bubbles
1 parent 825e389 commit 1417ec8

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ interface IChatListItemTemplate {
102102
readonly templateDisposables: IDisposable;
103103
readonly elementDisposables: DisposableStore;
104104
readonly agentHover: ChatAgentHover;
105-
readonly requestHover?: HTMLElement;
105+
readonly requestHover: HTMLElement;
106106
}
107107

108108
interface IItemHeightChangeParams {
@@ -379,7 +379,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
379379
this.hoverService.hideHover();
380380
}
381381
}));
382-
const template: IChatListItemTemplate = { header, avatarContainer, username, detail, value, rowContainer, elementDisposables, templateDisposables, contextKeyService, instantiationService: scopedInstantiationService, agentHover, titleToolbar, footerToolbar };
382+
const template: IChatListItemTemplate = { header, avatarContainer, requestHover, username, detail, value, rowContainer, elementDisposables, templateDisposables, contextKeyService, instantiationService: scopedInstantiationService, agentHover, titleToolbar, footerToolbar };
383383
return template;
384384
}
385385

@@ -438,21 +438,30 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
438438
this.renderAvatar(element, templateData);
439439
}
440440

441+
dom.hide(templateData.requestHover);
441442
dom.clearNode(templateData.detail);
442443
if (isResponseVM(element)) {
443444
this.renderDetail(element, templateData);
444445
}
445446

446447
templateData.rowContainer.classList.toggle(mostRecentResponseClassName, index === this.delegate.getListLength() - 1);
448+
templateData.rowContainer.classList.toggle('confirmation-message', isRequestVM(element) && !!element.confirmation);
447449

448-
if (isRequestVM(element) && element.confirmation) {
449-
this.renderConfirmationAction(element, templateData);
450+
if (isRequestVM(element)) {
451+
templateData.rowContainer.tabIndex = -1;
452+
} else {
453+
templateData.rowContainer.tabIndex = 0;
450454
}
451455

456+
452457
// TODO: @justschen decide if we want to hide the header for requests or not
453458
const shouldShowHeader = isResponseVM(element) && !this.rendererOptions.noHeader;
454459
templateData.header?.classList.toggle('header-disabled', !shouldShowHeader);
455460

461+
if (isRequestVM(element) && element.confirmation) {
462+
this.renderConfirmationAction(element, templateData);
463+
}
464+
456465
// Do a progressive render if
457466
// - This the last response in the list
458467
// - And it has some content
@@ -513,6 +522,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
513522
dom.clearNode(templateData.detail);
514523
if (element.confirmation) {
515524
templateData.detail.textContent = localize('chatConfirmationAction', 'selected "{0}"', element.confirmation);
525+
templateData.header?.classList.remove('header-disabled');
516526
}
517527
}
518528

@@ -1140,6 +1150,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
11401150
const fillInIncompleteTokens = isResponseVM(element) && (!element.isComplete || element.isCanceled || element.errorDetails?.responseIsFiltered || element.errorDetails?.responseIsIncomplete || !!element.renderData);
11411151
const codeBlockStartIndex = this.getCodeBlockStartIndex(context);
11421152
const markdownPart = templateData.instantiationService.createInstance(ChatMarkdownContentPart, markdown, context, this._editorPool, fillInIncompleteTokens, codeBlockStartIndex, this.renderer, this._currentLayoutWidth, this.codeBlockModelCollection, {});
1153+
if (isRequestVM(element)) {
1154+
markdownPart.domNode.tabIndex = 0;
1155+
}
1156+
11431157
markdownPart.addDisposable(markdownPart.onDidChangeHeight(() => {
11441158
markdownPart.layout(this._currentLayoutWidth);
11451159
this.updateItemHeight(templateData);

src/vs/workbench/contrib/chat/browser/media/chat.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,10 @@ have to be updated for changes to the rules above, or to support more deeply nes
18831883
padding-bottom: 0px;
18841884
}
18851885

1886+
.interactive-item-container.interactive-request.confirmation-message {
1887+
align-items: flex-start;
1888+
}
1889+
18861890
.interactive-item-container.interactive-request .value .rendered-markdown {
18871891
background-color: var(--vscode-chat-requestBubbleBackground);
18881892
border-radius: 8px;
@@ -1962,6 +1966,14 @@ have to be updated for changes to the rules above, or to support more deeply nes
19621966
top: 2px;
19631967
}
19641968
}
1969+
1970+
.interactive-item-container.interactive-request:focus {
1971+
outline: none !important;
1972+
}
1973+
1974+
.interactive-item-container.interactive-request .value .rendered-markdown:focus {
1975+
outline: 1px solid var(--vscode-focusBorder);
1976+
}
19651977
}
19661978

19671979
.chat-buttons-container {
@@ -1984,4 +1996,3 @@ have to be updated for changes to the rules above, or to support more deeply nes
19841996
width: initial;
19851997
padding: 4px 8px;
19861998
}
1987-

0 commit comments

Comments
 (0)