Skip to content

Commit 4284dea

Browse files
committed
get it close to working to navigate bw them
1 parent 02447a5 commit 4284dea

File tree

2 files changed

+42
-28
lines changed

2 files changed

+42
-28
lines changed

src/vs/workbench/browser/accessibility/accessibleView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ class AccessibleView extends Disposable {
174174
alert(localize('disableAccessibilityHelp', '{0} accessibility verbosity is now disabled', provider.verbositySettingKey));
175175
this._configurationService.updateValue(settingKey, false);
176176
}
177-
e.stopPropagation();
178177
provider.onKeyDown?.(e);
178+
e.stopPropagation();
179179
}));
180180
disposableStore.add(this._editorWidget.onKeyDown((e) => {
181181
if (e.keyCode === KeyCode.Escape) {

src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.ts

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
1111
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode';
1212
import { localize } from 'vs/nls';
1313
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
14-
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
14+
import { IKeybindingService, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
1515
import { AccessibilityHelpAction, AccessibleViewAction, registerAccessibilityConfiguration } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution';
1616
import { AccessibleViewService, AccessibleViewType, IAccessibleContentProvider, IAccessibleViewOptions, IAccessibleViewService } from 'vs/workbench/browser/accessibility/accessibleView';
1717
import * as strings from 'vs/base/common/strings';
@@ -27,6 +27,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
2727
import { getNotificationFromContext } from 'vs/workbench/browser/parts/notifications/notificationsCommands';
2828
import { IListService, WorkbenchList } from 'vs/platform/list/browser/listService';
2929
import { NotificationFocusedContext } from 'vs/workbench/common/contextkeys';
30+
import { KeyCode } from 'vs/base/common/keyCodes';
3031

3132
registerAccessibilityConfiguration();
3233
registerSingleton(IAccessibleViewService, AccessibleViewService, InstantiationType.Delayed);
@@ -144,33 +145,46 @@ class NotificationAccessibleViewContribution extends Disposable {
144145
this._register(AccessibleViewAction.addImplementation(90, 'notifications', accessor => {
145146
const accessibleViewService = accessor.get(IAccessibleViewService);
146147
const listService = accessor.get(IListService);
147-
const notification = getNotificationFromContext(listService);
148-
if (!notification) {
149-
return false;
150-
}
151-
let notificationIndex: number | undefined;
152-
const list = listService.lastFocusedList;
153-
if (list instanceof WorkbenchList) {
154-
notificationIndex = list.indexOf(notification);
155-
}
156-
if (notificationIndex === undefined) {
157-
return false;
158-
}
159-
accessibleViewService.show({
160-
provideContent: () => { return notification.message.original.toString() || ''; },
161-
onClose(): void {
162-
if (list && notificationIndex !== undefined) {
163-
list.domFocus();
164-
list.setFocus([notificationIndex]);
165-
}
166-
},
167-
verbositySettingKey: 'notifications',
168-
options: {
169-
ariaLabel: localize('notification', "Notification Accessible View"),
170-
type: AccessibleViewType.View
148+
149+
function show(): boolean {
150+
const notification = getNotificationFromContext(listService);
151+
if (!notification) {
152+
return false;
171153
}
172-
});
173-
return true;
154+
let notificationIndex: number | undefined;
155+
const list = listService.lastFocusedList;
156+
if (list instanceof WorkbenchList) {
157+
notificationIndex = list.indexOf(notification);
158+
}
159+
if (notificationIndex === undefined) {
160+
return false;
161+
}
162+
accessibleViewService.show({
163+
provideContent: () => { return notification.message.original.toString() || ''; },
164+
onClose(): void {
165+
if (list && notificationIndex !== undefined) {
166+
list.domFocus();
167+
list.setFocus([notificationIndex]);
168+
}
169+
},
170+
onKeyDown(e: IKeyboardEvent): void {
171+
if (e.keyCode === KeyCode.DownArrow && e.altKey && e.ctrlKey) {
172+
list?.focusNext();
173+
show();
174+
} else if (e.keyCode === KeyCode.UpArrow && e.altKey && e.ctrlKey) {
175+
list?.focusPrevious();
176+
show();
177+
}
178+
},
179+
verbositySettingKey: 'notifications',
180+
options: {
181+
ariaLabel: localize('notification', "Notification Accessible View"),
182+
type: AccessibleViewType.View
183+
}
184+
});
185+
return true;
186+
}
187+
return show();
174188
}, NotificationFocusedContext));
175189
}
176190
}

0 commit comments

Comments
 (0)