提交 73bf9d35 编写于 作者: I isidor

list: announce once element typing is done

上级 4e80e2fc
......@@ -394,6 +394,7 @@ class TypeLabelController<T> implements IDisposable {
const onInput = Event.reduce<string | null, string | null>(Event.any(onChar, onClear), (r, i) => i === null ? null : ((r || '') + i));
onInput(this.onInput, this, this.enabledDisposables);
onClear(this.onClear, this, this.enabledDisposables);
this.enabled = true;
this.triggered = false;
......@@ -409,6 +410,16 @@ class TypeLabelController<T> implements IDisposable {
this.triggered = false;
}
private onClear(): void {
const focus = this.list.getFocus();
if (focus.length > 0) {
const ariaLabel = this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(focus[0]));
if (ariaLabel) {
alert(ariaLabel);
}
}
}
private onInput(word: string | null): void {
if (!word) {
this.state = TypeLabelControllerState.Idle;
......@@ -429,14 +440,6 @@ 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?.getAriaLabel(this.list.element(index));
if (ariaLabel) {
alert(ariaLabel);
}
}
return;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册