Skip to content

Commit 645bb35

Browse files
authored
announce the query execution status change (#17474)
1 parent 55712ee commit 645bb35

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

localization/xliff/enu/constants/localizedConstants.enu.xlf

+3
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,9 @@
431431
<trans-unit id="executeQueryLabel">
432432
<source xml:lang="en">Executing query...</source>
433433
</trans-unit>
434+
<trans-unit id="QueryExecutedLabel">
435+
<source xml:lang="en">Query executed</source>
436+
</trans-unit>
434437
<trans-unit id="messagePaneLabel">
435438
<source xml:lang="en">Messages</source>
436439
</trans-unit>

src/views/statusView.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class StatusView implements vscode.Disposable {
7777
bar.statusLanguageFlavor = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 90);
7878
bar.statusConnection = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
7979
bar.statusQuery = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
80+
bar.statusQuery.accessibilityInformation = { role: 'alert', label: '' };
8081
bar.statusLanguageService = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
8182
bar.sqlCmdMode = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 90);
8283
bar.rowCount = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 80);
@@ -182,22 +183,26 @@ export default class StatusView implements vscode.Disposable {
182183
public executingQuery(fileUri: string): void {
183184
let bar = this.getStatusBar(fileUri);
184185
bar.statusQuery.command = undefined;
185-
bar.statusQuery.tooltip = LocalizedConstants.executeQueryLabel;
186+
bar.statusQuery.text = LocalizedConstants.executeQueryLabel;
186187
this.showStatusBarItem(fileUri, bar.statusQuery);
187188
this.showProgress(fileUri, LocalizedConstants.executeQueryLabel, bar.statusQuery);
188189
}
189190

190191
public executedQuery(fileUri: string): void {
191192
let bar = this.getStatusBar(fileUri);
192-
bar.statusQuery.hide();
193+
bar.statusQuery.text = LocalizedConstants.QueryExecutedLabel;
194+
// hide the status bar item with a delay so that the change can be announced by screen reader.
195+
setTimeout(() => {
196+
bar.statusQuery.hide();
197+
}, 200);
193198
}
194199

195200
public cancelingQuery(fileUri: string): void {
196201
let bar = this.getStatusBar(fileUri);
197202
bar.statusQuery.hide();
198203

199204
bar.statusQuery.command = undefined;
200-
bar.statusQuery.tooltip = LocalizedConstants.cancelingQueryLabel;
205+
bar.statusQuery.text = LocalizedConstants.cancelingQueryLabel;
201206
this.showStatusBarItem(fileUri, bar.statusQuery);
202207
this.showProgress(fileUri, LocalizedConstants.cancelingQueryLabel, bar.statusQuery);
203208
}
@@ -337,6 +342,11 @@ export default class StatusView implements vscode.Disposable {
337342
}
338343

339344
private showProgress(fileUri: string, statusText: string, statusBarItem: vscode.StatusBarItem): void {
345+
// Do not use the text based in progress indicator when screen reader is on, it is not user friendly to announce the changes every 200 ms.
346+
const screenReaderOptimized = vscode.workspace.getConfiguration('editor').get('accessibilitySupport');
347+
if (screenReaderOptimized === 'on') {
348+
return;
349+
}
340350
const self = this;
341351
let index = 0;
342352
let progressTicks = ['|', '/', '-', '\\'];

0 commit comments

Comments
 (0)