Skip to content

Commit f7a4e0d

Browse files
committed
1 parent 56614fb commit f7a4e0d

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { IListService, WorkbenchList } from 'vs/platform/list/browser/listServic
2828
import { NotificationFocusedContext } from 'vs/workbench/common/contextkeys';
2929
import { IAccessibleViewService, AccessibleViewService, IAccessibleContentProvider, IAccessibleViewOptions, AccessibleViewType, accessibleViewIsShown } from 'vs/workbench/contrib/accessibility/browser/accessibleView';
3030
import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
31+
import { alert } from 'vs/base/browser/ui/aria/aria';
3132

3233
registerAccessibilityConfiguration();
3334
registerSingleton(IAccessibleViewService, AccessibleViewService, InstantiationType.Delayed);
@@ -173,13 +174,16 @@ class NotificationAccessibleViewContribution extends Disposable {
173174
}
174175
commandService.executeCommand('notifications.showList');
175176
let notificationIndex: number | undefined;
177+
let length: number | undefined;
176178
const list = listService.lastFocusedList;
177179
if (list instanceof WorkbenchList) {
178180
notificationIndex = list.indexOf(notification);
181+
length = list.length;
179182
}
180183
if (notificationIndex === undefined) {
181184
return false;
182185
}
186+
183187
function focusList(): void {
184188
commandService.executeCommand('notifications.showList');
185189
if (list && notificationIndex !== undefined) {
@@ -206,6 +210,12 @@ class NotificationAccessibleViewContribution extends Disposable {
206210
}
207211
focusList();
208212
list.focusNext();
213+
if (notificationIndex) {
214+
const notificationNumber = notificationIndex + 1;
215+
if (!!notificationNumber && !!length && notificationNumber + 1 <= length) {
216+
alert(`Focused ${notificationNumber + 1} of ${length}`);
217+
}
218+
}
209219
renderAccessibleView();
210220
},
211221
previous(): void {
@@ -214,6 +224,12 @@ class NotificationAccessibleViewContribution extends Disposable {
214224
}
215225
focusList();
216226
list.focusPrevious();
227+
if (notificationIndex) {
228+
const notificationNumber = notificationIndex + 1;
229+
if (!!notificationNumber && !!length && notificationNumber - 1 > 0) {
230+
alert(`Focused ${notificationNumber - 1} of ${length}`);
231+
}
232+
}
217233
renderAccessibleView();
218234
},
219235
verbositySettingKey: AccessibilityVerbositySettingId.Notification,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export class AccessibleViewService extends Disposable implements IAccessibleView
271271
this._accessibleView = this._register(this._instantiationService.createInstance(AccessibleView));
272272
}
273273
this._accessibleView.show(provider);
274+
274275
}
275276
next(): void {
276277
this._accessibleView?.next();

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { CONTEXT_IN_CHAT_SESSION } from 'vs/workbench/contrib/chat/common/chatCo
4444
import { ChatAccessibilityService } from 'vs/workbench/contrib/chat/browser/chatAccessibilityService';
4545
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
4646
import { QuickQuestionMode } from 'vs/workbench/contrib/chat/browser/actions/quickQuestionActions/quickQuestionAction';
47+
import { alert } from 'vs/base/browser/ui/aria/aria';
4748

4849
// Register configuration
4950
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
@@ -175,6 +176,9 @@ class ChatAccessibleViewContribution extends Disposable {
175176
if (!responseContent) {
176177
return false;
177178
}
179+
const responses = verifiedWidget.viewModel?.getItems().filter(i => isResponseVM(i));
180+
const length = responses?.length;
181+
const responseIndex = responses?.findIndex(i => i === focusedItem);
178182

179183
accessibleViewService.show({
180184
verbositySettingKey: AccessibilityVerbositySettingId.Chat,
@@ -189,10 +193,20 @@ class ChatAccessibleViewContribution extends Disposable {
189193
},
190194
next() {
191195
verifiedWidget.moveFocus(focusedItem, 'next');
196+
if (responseIndex) {
197+
if (!!responseIndex && !!length && responseIndex + 1 <= length) {
198+
alert(`Focused ${responseIndex + 1} of ${length}`);
199+
}
200+
}
192201
renderAccessibleView(accessibleViewService, widgetService, codeEditorService);
193202
},
194203
previous() {
195204
verifiedWidget.moveFocus(focusedItem, 'previous');
205+
if (responseIndex) {
206+
if (!!responseIndex && !!length && responseIndex - 1 > 0) {
207+
alert(`Focused ${responseIndex + 1} of ${length}`);
208+
}
209+
}
196210
renderAccessibleView(accessibleViewService, widgetService, codeEditorService);
197211
},
198212
options: { ariaLabel: nls.localize('chatAccessibleView', "Chat Accessible View"), type: AccessibleViewType.View }

0 commit comments

Comments
 (0)