Skip to content

Commit 5a6e4ed

Browse files
committed
clean up
1 parent 8949642 commit 5a6e4ed

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { IChatReplyFollowup } from 'vs/workbench/contrib/chat/common/chatService
3232
import { IChatWidgetHistoryService } from 'vs/workbench/contrib/chat/common/chatWidgetHistoryService';
3333
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution';
3434
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
35-
import { isWindows } from 'vs/base/common/platform';
35+
import { isMacintosh } from 'vs/base/common/platform';
3636

3737
const $ = dom.$;
3838

@@ -153,21 +153,24 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
153153
this.history.add(editorValue);
154154
}
155155

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 {
156165
const domNode = this._inputEditor.getDomNode();
157166
if (!domNode) {
158167
return;
159168
}
160-
// Remove the input editor from the DOM temporarily to avoid the screen reader
161-
// from reading the cleared text (the request) to the user. On Windows, we don't need to do this
162-
// and it could cause issues.
163-
const handleDom = this.accessibilityService.isScreenReaderOptimized() && !isWindows;
164-
if (handleDom) {
165-
this._inputEditorElement.removeChild(domNode);
166-
}
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);
167172
this._inputEditor.setValue('');
168-
if (handleDom) {
169-
this._inputEditorElement.appendChild(domNode);
170-
}
173+
this._inputEditorElement.appendChild(domNode);
171174
this._inputEditor.focus();
172175
}
173176

0 commit comments

Comments
 (0)