Skip to content

Commit ffe90c3

Browse files
committed
Defer updating screen reader content when no in a11y mode
Before TextAreaHandler.onCursorStateChanged was taking approximately 4-16% of the total keypress task's runtime. After this is becomes < 0.5ms. Part of microsoft#161622
1 parent 1bcb42f commit ffe90c3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/vs/editor/browser/controller/textAreaHandler.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,11 @@ export class TextAreaHandler extends ViewPart {
575575
public override onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {
576576
this._selections = e.selections.slice(0);
577577
this._modelSelections = e.modelSelections.slice(0);
578-
this._textAreaInput.writeScreenReaderContent('selection changed');
578+
if (this._accessibilitySupport === AccessibilitySupport.Enabled) {
579+
this._textAreaInput.writeScreenReaderContent('selection changed');
580+
} else {
581+
setTimeout(() => this._textAreaInput.writeScreenReaderContent('selection changed'), 0);
582+
}
579583
return true;
580584
}
581585
public override onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {

0 commit comments

Comments
 (0)