@@ -23,6 +23,7 @@ import { IEditorWorkerService } from 'vs/editor/common/services/editorWorker';
23
23
import { IModelService } from 'vs/editor/common/services/model' ;
24
24
import { InlineCompletionsController } from 'vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController' ;
25
25
import { localize } from 'vs/nls' ;
26
+ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility' ;
26
27
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
27
28
import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
28
29
import { IDialogService } from 'vs/platform/dialogs/common/dialogs' ;
@@ -105,6 +106,7 @@ export class InteractiveEditorController implements IEditorContribution {
105
106
@INotebookEditorService private readonly _notebookEditorService : INotebookEditorService ,
106
107
@IDialogService private readonly _dialogService : IDialogService ,
107
108
@IContextKeyService contextKeyService : IContextKeyService ,
109
+ @IAccessibilityService private readonly _accessibilityService : IAccessibilityService
108
110
) {
109
111
this . _ctxHasActiveRequest = CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST . bindTo ( contextKeyService ) ;
110
112
this . _ctxLastEditKind = CTX_INTERACTIVE_EDITOR_LAST_EDIT_KIND . bindTo ( contextKeyService ) ;
@@ -137,6 +139,17 @@ export class InteractiveEditorController implements IEditorContribution {
137
139
return INTERACTIVE_EDITOR_ID ;
138
140
}
139
141
142
+ private _getMode ( ) : EditMode {
143
+ let editMode : EditMode = this . _configurationService . getValue ( 'interactiveEditor.editMode' ) ;
144
+ const isDefault = editMode === EditMode . LivePreview ;
145
+ if ( this . _accessibilityService . isScreenReaderOptimized ( ) && isDefault ) {
146
+ // By default, use preview mode for screen reader users
147
+ editMode = EditMode . Preview ;
148
+ this . _configurationService . updateValue ( 'interactiveEditor.editMode' , EditMode . Preview ) ;
149
+ }
150
+ return editMode ;
151
+ }
152
+
140
153
getWidgetPosition ( ) : Position | undefined {
141
154
return this . _zone . position ;
142
155
}
@@ -171,7 +184,7 @@ export class InteractiveEditorController implements IEditorContribution {
171
184
172
185
session = await this . _interactiveEditorSessionService . createSession (
173
186
this . _editor ,
174
- { editMode : this . _configurationService . getValue ( 'interactiveEditor.editMode' ) , wholeRange : options ?. initialRange } ,
187
+ { editMode : this . _getMode ( ) , wholeRange : options ?. initialRange } ,
175
188
createSessionCts . token
176
189
) ;
177
190
0 commit comments