Skip to content

Commit 381ad34

Browse files
Guangyue XuDevtools-frontend LUCI CQ
authored andcommitted
Announce search results in developer resources panel
When user updates the filter box in the developer resources panel, announce the number of resources match in the output panel to notify the user who relies on screen reader. Bug: 383444971 Change-Id: I37f2629875f6ca88b42a307c1e2427a30fd44203 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6089910 Commit-Queue: Guangyue Xu <[email protected]> Reviewed-by: Alex Rudenko <[email protected]>
1 parent e5dedfe commit 381ad34

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

front_end/panels/developer_resources/DeveloperResourcesListView.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ export class DeveloperResourcesListView extends UI.Widget.VBox {
197197
}
198198
}
199199

200+
getNumberOfVisibleItems(): number {
201+
return this.dataGrid.rootNode().children.length;
202+
}
203+
200204
private sortingChanged(): void {
201205
const columnId = this.dataGrid.sortColumnId();
202206
if (!columnId) {

front_end/panels/developer_resources/DeveloperResourcesView.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ const UIStrings = {
4141
* total. Resources are files related to the webpage.
4242
*/
4343
resources: '{n, plural, =1 {# resource} other {# resources}}',
44+
/**
45+
* @description Nnumber of resource(s) match
46+
*/
47+
numberOfResourceMatch: '{n, plural, =1 {# resource matches} other {# resources match}}',
48+
/**
49+
* @description No resource matches
50+
*/
51+
noResourceMatches: 'No resource matches',
4452
};
4553
const str_ = i18n.i18n.registerUIStrings('panels/developer_resources/DeveloperResourcesView.ts', UIStrings);
4654
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -141,6 +149,15 @@ export class DeveloperResourcesView extends UI.ThrottledWidget.ThrottledWidget {
141149
this.textFilterRegExp = text ? Platform.StringUtilities.createPlainTextSearchRegex(text, 'i') : null;
142150
this.listView.updateFilterAndHighlight(this.textFilterRegExp);
143151
this.updateStats();
152+
153+
const numberOfResourceMatch = this.listView.getNumberOfVisibleItems();
154+
let resourceMatch = '';
155+
if (numberOfResourceMatch === 0) {
156+
resourceMatch = i18nString(UIStrings.noResourceMatches);
157+
} else {
158+
resourceMatch = i18nString(UIStrings.numberOfResourceMatch, {n: numberOfResourceMatch});
159+
}
160+
UI.ARIAUtils.alert(resourceMatch);
144161
}
145162

146163
override wasShown(): void {

0 commit comments

Comments
 (0)