Skip to content

Commit 13dd130

Browse files
committed
always show toolbar for screen reader mode
1 parent ebde1b6 commit 13dd130

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ export function getAccessibilityHelpText(accessor: ServicesAccessor, type: 'chat
2525
if (type === 'chat') {
2626
content.push(descriptionForCommand('chat.action.focus', localize('workbench.action.chat.focus', 'The Focus Chat command ({0}) focuses the chat request/response list, which can be navigated with UpArrow/DownArrow.',), localize('workbench.action.chat.focusNoKb', 'The Focus Chat List command focuses the chat request/response list, which can be navigated with UpArrow/DownArrow and is currently not triggerable by a keybinding.'), keybindingService));
2727
content.push(descriptionForCommand('workbench.action.chat.focusInput', localize('workbench.action.chat.focusInput', 'The Focus Chat Input command ({0}) focuses the input box for chat requests.'), localize('workbench.action.interactiveSession.focusInputNoKb', 'Focus Chat Input command focuses the input box for chat requests and is currently not triggerable by a keybinding.'), keybindingService));
28-
content.push('Chat responses may contain code blocks which can be tabbed to. Use typical editor keybindings to select and copy text. To further interact with these code blocks, run the following commands:');
29-
content.push(descriptionForCommand('workbench.action.chat.insertCodeBlock', localize('workbench.action.chat.insertCodeBlock', 'Insert Code Block ({0}) inserts the code at the current cursor location in last active editor'), localize('workbench.action.chat.insertCodeBlockNoKb', 'Insert Code Block inserts the code at the current cursor location and is currently not triggerable by a keybinding.'), keybindingService));
30-
content.push(descriptionForCommand('workbench.action.chat.insertIntoNewFile', localize('workbench.action.chat.insertIntoNewFile', 'Insert into New File ({0}) creates a new file with the code block as its content'), localize('workbench.action.chat.insertIntoNewFileNoKb', 'Insert into New File creates a new file with the code block as its content and is currently not triggerable by a keybinding.'), keybindingService));
31-
content.push(descriptionForCommand('workbench.action.chat.runInTerminal', localize('workbench.action.chat.runInTerminal', 'Run in Terminal ({0}) runs the code block in the terminal'), localize('workbench.action.chat.runInTerminalNoKb', 'Run in Terminal runs the code block in the terminal and is currently not triggerable by a keybinding.'), keybindingService));
3228
} else {
3329
content.push(interactiveEditorHelpIntro);
3430
const regex = /^(\/fix|\/explain)/;

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { CONTEXT_RESPONSE_HAS_PROVIDER_ID, CONTEXT_RESPONSE_VOTE } from 'vs/work
5858
import { IChatReplyFollowup, IChatService, ISlashCommand, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
5959
import { IChatRequestViewModel, IChatResponseViewModel, IChatWelcomeMessageViewModel, isRequestVM, isResponseVM, isWelcomeVM } from 'vs/workbench/contrib/chat/common/chatViewModel';
6060
import { IWordCountResult, getNWords } from 'vs/workbench/contrib/chat/common/chatWordCounter';
61+
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
6162
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution';
6263

6364
const $ = dom.$;
@@ -583,11 +584,11 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
583584
@IContextKeyService contextKeyService: IContextKeyService,
584585
@ILanguageService private readonly languageService: ILanguageService,
585586
@IModelService private readonly modelService: IModelService,
586-
@IConfigurationService private readonly _configurationService: IConfigurationService
587+
@IConfigurationService private readonly _configurationService: IConfigurationService,
588+
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService
587589
) {
588590
super();
589591
this.element = $('.interactive-result-editor-wrapper');
590-
591592
this.contextKeyService = this._register(contextKeyService.createScoped(this.element));
592593
const scopedInstantiationService = instantiationService.createChild(new ServiceCollection([IContextKeyService, this.contextKeyService]));
593594
this.toolbar = this._register(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, this.element, MenuId.ChatCodeBlock, {
@@ -596,6 +597,12 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
596597
}
597598
}));
598599

600+
if (this._accessibilityService.isScreenReaderOptimized()) {
601+
const toolbarElt = this.toolbar.getElement();
602+
toolbarElt.style.display = 'block';
603+
toolbarElt.ariaLabel = this._configurationService.getValue(AccessibilityVerbositySettingId.Chat) ? localize('chat.codeBlock.toolbarVerbose', 'Toolbar for code block which can be reached via tab') : localize('chat.codeBlock.toolbar', 'Code block toolbar');
604+
}
605+
599606
const editorElement = dom.append(this.element, $('.interactive-result-editor'));
600607
this.editor = this._register(scopedInstantiationService.createInstance(CodeEditorWidget, editorElement, {
601608
...getSimpleEditorOptions(),
@@ -610,7 +617,7 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
610617
scrollbar: {
611618
alwaysConsumeMouseWheel: false
612619
},
613-
ariaLabel: this._configurationService.getValue(AccessibilityVerbositySettingId.Chat) ? localize('chat.codeBlockHelp', 'Code block, to discover ways this can be interacted with, search the command palette for Chat: Insert and Chat: Run.') : localize('chat.codeBlock', 'Code block'),
620+
ariaLabel: localize('chat.codeBlockHelp', 'Code block'),
614621
...this.getEditorOptionsFromConfig()
615622
}, {
616623
isSimpleWidget: true,

0 commit comments

Comments
 (0)