Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug causing an aria alert to not be shown the third time #55542

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/vs/base/browser/ui/aria/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,27 @@ export function status(msg: string): void {
}
}

let repeatedTimes = 0;
let prevText: string | undefined = undefined;
function insertMessage(target: HTMLElement, msg: string): void {
if (!ariaContainer) {
// console.warn('ARIA support needs a container. Call setARIAContainer() first.');
return;
}
if (target.textContent === msg) {
msg = nls.localize('repeated', "{0} (occurred again)", msg);

if (prevText === msg) {
repeatedTimes++;
}
else {
prevText = msg;
repeatedTimes = 0;
}


switch (repeatedTimes) {
case 0: break;
case 1: msg = nls.localize('repeated', "{0} (occurred again)", msg); break;
default: msg = nls.localize('repeatedNtimes', "{0} (occurred {1} times)", msg, repeatedTimes); break;
}

dom.clearNode(target);
Expand Down