Skip to content

Commit 8800bc8

Browse files
committed
listen for screen reader changes
1 parent ebb889e commit 8800bc8

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,12 +597,13 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
597597
}
598598
}));
599599

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-
600+
this._configureForScreenReader();
601+
this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => this._configureForScreenReader()));
602+
this._register(this._configurationService.onDidChangeConfiguration((e) => {
603+
if (e.affectedKeys.has(AccessibilityVerbositySettingId.Chat)) {
604+
this._configureForScreenReader();
605+
}
606+
}));
606607
const editorElement = dom.append(this.element, $('.interactive-result-editor'));
607608
this.editor = this._register(scopedInstantiationService.createInstance(CodeEditorWidget, editorElement, {
608609
...getSimpleEditorOptions(),
@@ -672,6 +673,17 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
672673
this.editor.updateOptions({ padding: { top: defaultCodeblockPadding, bottom: bottomPadding } });
673674
}
674675

676+
private _configureForScreenReader(): void {
677+
const toolbarElt = this.toolbar.getElement();
678+
if (this._accessibilityService.isScreenReaderOptimized()) {
679+
toolbarElt.style.display = 'block';
680+
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');
681+
} else {
682+
toolbarElt.style.display = '';
683+
}
684+
685+
}
686+
675687
private getEditorOptionsFromConfig(): IEditorOptions {
676688
return {
677689
wordWrap: this.options.configuration.resultEditor.wordWrap,

0 commit comments

Comments
 (0)