This commit is contained in:
meganrogge 2023-07-27 12:18:30 -07:00
parent b7bf8b07e4
commit 1320f52612
No known key found for this signature in database
GPG key ID: AA74638D4878183D
2 changed files with 19 additions and 25 deletions

View file

@ -210,12 +210,7 @@ class NotificationAccessibleViewContribution extends Disposable {
}
focusList();
list.focusNext();
if (!!notificationIndex) {
const notificationNumber = notificationIndex + 1;
if (!!notificationNumber && !!length && notificationNumber + 1 <= length) {
alert(`Focused ${notificationNumber + 1} of ${length}`);
}
}
alertFocusChange(notificationIndex, length, 'next');
renderAccessibleView();
},
previous(): void {
@ -224,12 +219,7 @@ class NotificationAccessibleViewContribution extends Disposable {
}
focusList();
list.focusPrevious();
if (!!notificationIndex) {
const notificationNumber = notificationIndex + 1;
if (!!notificationNumber && !!length && notificationNumber - 1 > 0) {
alert(`Focused ${notificationNumber - 1} of ${length}`);
}
}
alertFocusChange(notificationIndex, length, 'previous');
renderAccessibleView();
},
verbositySettingKey: AccessibilityVerbositySettingId.Notification,
@ -265,3 +255,17 @@ class AccessibleViewNavigatorContribution extends Disposable {
}
workbenchContributionsRegistry.registerWorkbenchContribution(AccessibleViewNavigatorContribution, LifecyclePhase.Eventually);
export function alertFocusChange(index: number | undefined, length: number | undefined, type: 'next' | 'previous'): void {
if (index === undefined || length === undefined) {
return;
}
const number = index + 1;
if (type === 'next' && number + 1 > length) {
alert(`Focused ${number + 1} of ${length}`);
} else if (type === 'previous' && number - 1 > 0) {
alert(`Focused ${number - 1} of ${length}`);
}
return;
}

View file

@ -44,7 +44,7 @@ import { CONTEXT_IN_CHAT_SESSION } from 'vs/workbench/contrib/chat/common/chatCo
import { ChatAccessibilityService } from 'vs/workbench/contrib/chat/browser/chatAccessibilityService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { QuickQuestionMode } from 'vs/workbench/contrib/chat/browser/actions/quickQuestionActions/quickQuestionAction';
import { alert } from 'vs/base/browser/ui/aria/aria';
import { alertFocusChange } from 'vs/workbench/contrib/accessibility/browser/accessibility.contribution';
// Register configuration
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
@ -193,22 +193,12 @@ class ChatAccessibleViewContribution extends Disposable {
},
next() {
verifiedWidget.moveFocus(focusedItem, 'next');
if (!!responseIndex) {
const notificationNumber = responseIndex + 1;
if (!!notificationNumber && !!length && notificationNumber + 1 <= length) {
alert(`Focused ${notificationNumber + 1} of ${length}`);
}
}
alertFocusChange(responseIndex, length, 'next');
renderAccessibleView(accessibleViewService, widgetService, codeEditorService);
},
previous() {
verifiedWidget.moveFocus(focusedItem, 'previous');
if (!!responseIndex) {
const notificationNumber = responseIndex + 1;
if (!!notificationNumber && !!length && notificationNumber - 1 > 0) {
alert(`Focused ${notificationNumber - 1} of ${length}`);
}
}
alertFocusChange(responseIndex, length, 'previous');
renderAccessibleView(accessibleViewService, widgetService, codeEditorService);
},
options: { ariaLabel: nls.localize('chatAccessibleView', "Chat Accessible View"), type: AccessibleViewType.View }