@@ -28,6 +28,7 @@ import { IListService, WorkbenchList } from 'vs/platform/list/browser/listServic
28
28
import { NotificationFocusedContext } from 'vs/workbench/common/contextkeys' ;
29
29
import { IAccessibleViewService , AccessibleViewService , IAccessibleContentProvider , IAccessibleViewOptions , AccessibleViewType , accessibleViewIsShown } from 'vs/workbench/contrib/accessibility/browser/accessibleView' ;
30
30
import { IHoverService } from 'vs/workbench/services/hover/browser/hover' ;
31
+ import { alert } from 'vs/base/browser/ui/aria/aria' ;
31
32
32
33
registerAccessibilityConfiguration ( ) ;
33
34
registerSingleton ( IAccessibleViewService , AccessibleViewService , InstantiationType . Delayed ) ;
@@ -173,13 +174,16 @@ class NotificationAccessibleViewContribution extends Disposable {
173
174
}
174
175
commandService . executeCommand ( 'notifications.showList' ) ;
175
176
let notificationIndex : number | undefined ;
177
+ let length : number | undefined ;
176
178
const list = listService . lastFocusedList ;
177
179
if ( list instanceof WorkbenchList ) {
178
180
notificationIndex = list . indexOf ( notification ) ;
181
+ length = list . length ;
179
182
}
180
183
if ( notificationIndex === undefined ) {
181
184
return false ;
182
185
}
186
+
183
187
function focusList ( ) : void {
184
188
commandService . executeCommand ( 'notifications.showList' ) ;
185
189
if ( list && notificationIndex !== undefined ) {
@@ -206,6 +210,7 @@ class NotificationAccessibleViewContribution extends Disposable {
206
210
}
207
211
focusList ( ) ;
208
212
list . focusNext ( ) ;
213
+ alertFocusChange ( notificationIndex , length , 'next' ) ;
209
214
renderAccessibleView ( ) ;
210
215
} ,
211
216
previous ( ) : void {
@@ -214,6 +219,7 @@ class NotificationAccessibleViewContribution extends Disposable {
214
219
}
215
220
focusList ( ) ;
216
221
list . focusPrevious ( ) ;
222
+ alertFocusChange ( notificationIndex , length , 'previous' ) ;
217
223
renderAccessibleView ( ) ;
218
224
} ,
219
225
verbositySettingKey : AccessibilityVerbositySettingId . Notification ,
@@ -249,3 +255,17 @@ class AccessibleViewNavigatorContribution extends Disposable {
249
255
}
250
256
251
257
workbenchContributionsRegistry . registerWorkbenchContribution ( AccessibleViewNavigatorContribution , LifecyclePhase . Eventually ) ;
258
+
259
+ export function alertFocusChange ( index : number | undefined , length : number | undefined , type : 'next' | 'previous' ) : void {
260
+ if ( index === undefined || length === undefined ) {
261
+ return ;
262
+ }
263
+ const number = index + 1 ;
264
+
265
+ if ( type === 'next' && number + 1 <= length ) {
266
+ alert ( `Focused ${ number + 1 } of ${ length } ` ) ;
267
+ } else if ( type === 'previous' && number - 1 > 0 ) {
268
+ alert ( `Focused ${ number - 1 } of ${ length } ` ) ;
269
+ }
270
+ return ;
271
+ }
0 commit comments