mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
clean up
This commit is contained in:
parent
b7bf8b07e4
commit
1320f52612
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue