Skip to content

Commit

Permalink
Focus did not change with typing, re-announce element #95961
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed May 6, 2020
1 parent 24fb571 commit 6e5f972
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/vs/base/browser/ui/list/listWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { CombinedSpliceable } from 'vs/base/browser/ui/list/splice';
import { clamp } from 'vs/base/common/numbers';
import { matchesPrefix } from 'vs/base/common/filters';
import { IDragAndDropData } from 'vs/base/browser/dnd';
import { alert } from 'vs/base/browser/ui/aria/aria';

interface ITraitChangeEvent {
indexes: number[];
Expand Down Expand Up @@ -428,6 +429,14 @@ class TypeLabelController<T> implements IDisposable {
if (typeof labelStr === 'undefined' || matchesPrefix(word, labelStr)) {
this.list.setFocus([index]);
this.list.reveal(index);

if (index === start) {
// Focus did not change with typing, re-announce element https://github.com/microsoft/vscode/issues/95961
const ariaLabel = this.list.options.accessibilityProvider ? this.list.options.accessibilityProvider.getAriaLabel(this.list.element(index)) : undefined;
if (ariaLabel) {
alert(ariaLabel);
}
}
return;
}
}
Expand Down

0 comments on commit 6e5f972

Please sign in to comment.