@@ -31,6 +31,8 @@ import { CONTEXT_CHAT_INPUT_HAS_TEXT, CONTEXT_IN_CHAT_INPUT } from 'vs/workbench
31
31
import { IChatReplyFollowup } from 'vs/workbench/contrib/chat/common/chatService' ;
32
32
import { IChatWidgetHistoryService } from 'vs/workbench/contrib/chat/common/chatWidgetHistoryService' ;
33
33
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution' ;
34
+ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility' ;
35
+ import { isMacintosh } from 'vs/base/common/platform' ;
34
36
35
37
const $ = dom . $ ;
36
38
@@ -59,6 +61,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
59
61
private followupsDisposables = this . _register ( new DisposableStore ( ) ) ;
60
62
61
63
private _inputEditor ! : CodeEditorWidget ;
64
+ private _inputEditorElement ! : HTMLElement ;
65
+
62
66
public get inputEditor ( ) {
63
67
return this . _inputEditor ;
64
68
}
@@ -78,7 +82,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
78
82
@IInstantiationService private readonly instantiationService : IInstantiationService ,
79
83
@IContextKeyService private readonly contextKeyService : IContextKeyService ,
80
84
@IConfigurationService private readonly configurationService : IConfigurationService ,
81
- @IKeybindingService private readonly keybindingService : IKeybindingService
85
+ @IKeybindingService private readonly keybindingService : IKeybindingService ,
86
+ @IAccessibilityService private readonly accessibilityService : IAccessibilityService
82
87
) {
83
88
super ( ) ;
84
89
@@ -148,8 +153,25 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
148
153
this . history . add ( editorValue ) ;
149
154
}
150
155
151
- this . _inputEditor . focus ( ) ;
156
+ if ( this . accessibilityService . isScreenReaderOptimized ( ) && isMacintosh ) {
157
+ this . _acceptInputForVoiceover ( ) ;
158
+ } else {
159
+ this . _inputEditor . focus ( ) ;
160
+ this . _inputEditor . setValue ( '' ) ;
161
+ }
162
+ }
163
+
164
+ private _acceptInputForVoiceover ( ) : void {
165
+ const domNode = this . _inputEditor . getDomNode ( ) ;
166
+ if ( ! domNode ) {
167
+ return ;
168
+ }
169
+ // Remove the input editor from the DOM temporarily to prevent VoiceOver
170
+ // from reading the cleared text (the request) to the user.
171
+ this . _inputEditorElement . removeChild ( domNode ) ;
152
172
this . _inputEditor . setValue ( '' ) ;
173
+ this . _inputEditorElement . appendChild ( domNode ) ;
174
+ this . _inputEditor . focus ( ) ;
153
175
}
154
176
155
177
render ( container : HTMLElement , initialValue : string , widget : IChatWidget ) {
@@ -181,8 +203,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
181
203
options . suggest = { showIcons : false } ;
182
204
options . scrollbar = { ...( options . scrollbar ?? { } ) , vertical : 'hidden' } ;
183
205
184
- const inputEditorElement = dom . append ( inputContainer , $ ( '.interactive-input-editor' ) ) ;
185
- this . _inputEditor = this . _register ( scopedInstantiationService . createInstance ( CodeEditorWidget , inputEditorElement , options , getSimpleCodeEditorWidgetOptions ( ) ) ) ;
206
+ this . _inputEditorElement = dom . append ( inputContainer , $ ( '.interactive-input-editor' ) ) ;
207
+ this . _inputEditor = this . _register ( scopedInstantiationService . createInstance ( CodeEditorWidget , this . _inputEditorElement , options , getSimpleCodeEditorWidgetOptions ( ) ) ) ;
186
208
187
209
this . _register ( this . _inputEditor . onDidChangeModelContent ( ( ) => {
188
210
const currentHeight = Math . min ( this . _inputEditor . getContentHeight ( ) , INPUT_EDITOR_MAX_HEIGHT ) ;
0 commit comments