Skip to content

Commit 3e000c9

Browse files
ElormCochDevtools-frontend LUCI CQ
authored andcommitted
Improve screen reader announcement of bfcache test result
Issue: After the test bfcache button is invoked, the re-renders and so focus is lost from the button to the devtools window resulting in incorrect and missing screenreader announcements. Fix: After rendering the results, we announce the tests were completed and keep focus on the results section view where the announcement happens. Bug: 455905510 Change-Id: I15674c8291a703317dccad7dd42d57d23e231a62 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7090941 Reviewed-by: Wolfgang Beyer <[email protected]> Commit-Queue: Sylvester Elorm Coch <[email protected]>
1 parent cc6f981 commit 3e000c9

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

front_end/panels/application/components/BackForwardCacheView.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import * as RenderCoordinator from '../../../ui/components/render_coordinator/re
2020
import type * as ReportView from '../../../ui/components/report_view/report_view.js';
2121
import type * as TreeOutline from '../../../ui/components/tree_outline/tree_outline.js';
2222
import * as Components from '../../../ui/legacy/components/utils/utils.js';
23+
import * as UI from '../../../ui/legacy/legacy.js';
2324
import * as Lit from '../../../ui/lit/lit.js';
2425
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
2526

@@ -66,6 +67,10 @@ const UIStrings = {
6667
* page eligible for back/forward cache.
6768
*/
6869
pageSupportNeeded: 'Actionable',
70+
/**
71+
* @description Label for the completion of the back/forward cache test
72+
*/
73+
testCompleted: 'Back/forward cache test completed.',
6974
/**
7075
* @description Explanation for actionable items which prevent the page from being eligible
7176
* for back/forward cache.
@@ -279,7 +284,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): Lit.TemplateRe
279284
case true:
280285
// clang-format off
281286
return html`
282-
<devtools-report-section>
287+
<devtools-report-section class="cache-status-section" tabindex="-1">
283288
<div class="status extra-large">
284289
<devtools-icon class="inline-icon extra-large" name="check-circle" style="color: var(--icon-checkmark-green);">
285290
</devtools-icon>
@@ -290,7 +295,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): Lit.TemplateRe
290295
case false:
291296
// clang-format off
292297
return html`
293-
<devtools-report-section>
298+
<devtools-report-section class="cache-status-section" tabindex="-1">
294299
<div class="status">
295300
<devtools-icon class="inline-icon extra-large" name="clear">
296301
</devtools-icon>
@@ -301,7 +306,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): Lit.TemplateRe
301306
}
302307
// clang-format off
303308
return html`
304-
<devtools-report-section>
309+
<devtools-report-section class="cache-status-section" tabindex="-1">
305310
${i18nString(UIStrings.unknown)}
306311
</devtools-report-section>`;
307312
// clang-format on
@@ -510,7 +515,13 @@ export class BackForwardCacheView extends LegacyWrapper.LegacyWrapper.WrappableC
510515
SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated,
511516
this.#renderBackForwardCacheTestResult, this);
512517
this.#screenStatus = ScreenStatusType.RESULT;
513-
void this.render();
518+
void this.render().then(() => {
519+
UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.testCompleted));
520+
const resultsSection = this.shadowRoot?.querySelector('.cache-status-section') as HTMLElement;
521+
if (resultsSection) {
522+
resultsSection.focus();
523+
}
524+
});
514525
}
515526

516527
async #onNavigatedAway(): Promise<void> {

front_end/panels/application/components/backForwardCacheView.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ devtools-report-value:has(devtools-tree-outline) {
7373
margin-left: var(--sys-size-7);
7474
}
7575

76+
.cache-status-section:focus-visible {
77+
outline: 0;
78+
}
79+
7680
.tree-outline li .selection {
7781
margin-left: -5px;
7882
}

0 commit comments

Comments
 (0)