@@ -11,7 +11,7 @@ import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
11
11
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode' ;
12
12
import { localize } from 'vs/nls' ;
13
13
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' ;
15
15
import { AccessibilityHelpAction , AccessibleViewAction , registerAccessibilityConfiguration } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution' ;
16
16
import * as strings from 'vs/base/common/strings' ;
17
17
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
@@ -27,6 +27,7 @@ import { getNotificationFromContext } from 'vs/workbench/browser/parts/notificat
27
27
import { IListService , WorkbenchList } from 'vs/platform/list/browser/listService' ;
28
28
import { NotificationFocusedContext } from 'vs/workbench/common/contextkeys' ;
29
29
import { IAccessibleViewService , AccessibleViewService , IAccessibleContentProvider , IAccessibleViewOptions , AccessibleViewType } from 'vs/workbench/contrib/accessibility/browser/accessibleView' ;
30
+ import { KeyCode } from 'vs/base/common/keyCodes' ;
30
31
31
32
registerAccessibilityConfiguration ( ) ;
32
33
registerSingleton ( IAccessibleViewService , AccessibleViewService , InstantiationType . Delayed ) ;
@@ -158,11 +159,12 @@ class NotificationAccessibleViewContribution extends Disposable {
158
159
const listService = accessor . get ( IListService ) ;
159
160
const commandService = accessor . get ( ICommandService ) ;
160
161
161
- function show ( ) : boolean {
162
+ function renderAccessibleView ( ) : boolean {
162
163
const notification = getNotificationFromContext ( listService ) ;
163
164
if ( ! notification ) {
164
165
return false ;
165
166
}
167
+ commandService . executeCommand ( 'notifications.showList' ) ;
166
168
let notificationIndex : number | undefined ;
167
169
const list = listService . lastFocusedList ;
168
170
if ( list instanceof WorkbenchList ) {
@@ -171,16 +173,38 @@ class NotificationAccessibleViewContribution extends Disposable {
171
173
if ( notificationIndex === undefined ) {
172
174
return false ;
173
175
}
176
+ function focusList ( ) : void {
177
+ commandService . executeCommand ( 'notifications.showList' ) ;
178
+ if ( list && notificationIndex !== undefined ) {
179
+ list . domFocus ( ) ;
180
+ try {
181
+ list . setFocus ( [ notificationIndex ] ) ;
182
+ } catch { }
183
+ }
184
+ }
185
+ const message = notification . message . original . toString ( ) ;
186
+ if ( ! message ) {
187
+ return false ;
188
+ }
174
189
accessibleViewService . show ( {
175
190
provideContent : ( ) => {
176
- return localize ( 'notification.accessibleView' , '{0} Source: {1}' , notification . message . original . toString ( ) || '' , notification . source ) ;
191
+ return localize ( 'notification.accessibleView' , '{0} Source: {1}' , message , notification . source ) ;
177
192
} ,
178
193
onClose ( ) : void {
179
- // The notification list might have hidden depending on the elapsed time, so show it.
180
- commandService . executeCommand ( 'notifications.showList' ) ;
181
- if ( list && notificationIndex !== undefined ) {
182
- list . domFocus ( ) ;
183
- list . setFocus ( [ notificationIndex ] ) ;
194
+ focusList ( ) ;
195
+ } ,
196
+ onKeyDown ( e : IKeyboardEvent ) : void {
197
+ if ( ! list ) {
198
+ return ;
199
+ }
200
+ if ( e . altKey && e . keyCode === KeyCode . BracketRight ) {
201
+ focusList ( ) ;
202
+ list . focusNext ( ) ;
203
+ renderAccessibleView ( ) ;
204
+ } else if ( e . altKey && e . keyCode === KeyCode . BracketLeft ) {
205
+ focusList ( ) ;
206
+ list . focusPrevious ( ) ;
207
+ renderAccessibleView ( ) ;
184
208
}
185
209
} ,
186
210
verbositySettingKey : 'notifications' ,
@@ -191,7 +215,7 @@ class NotificationAccessibleViewContribution extends Disposable {
191
215
} ) ;
192
216
return true ;
193
217
}
194
- return show ( ) ;
218
+ return renderAccessibleView ( ) ;
195
219
} , NotificationFocusedContext ) ) ;
196
220
}
197
221
}
0 commit comments