Skip to content

Commit ea8b232

Browse files
Samiya CaurDevtools-frontend LUCI CQ
Samiya Caur
authored and
Devtools-frontend LUCI CQ
committed
Provide screen reader feedback when changes are applied
- Screen reader announces the status message "Applying to workspace" - After content updates successfully, focus is set to the "File changes in <folder name>" header Bug: 406076749 Change-Id: I5f7bb0081e31619a37635b96f86f2f2664523149 Fixed: 406076749 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6445512 Auto-Submit: Samiya Caur <samiyac@chromium.org> Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org> Commit-Queue: Ergün Erdoğmuş <ergunsh@chromium.org>
1 parent 286ae00 commit ea8b232

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

front_end/panels/ai_assistance/PatchWidget.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export interface ViewInput {
184184
export interface ViewOutput {
185185
tooltipRef?: Directives.Ref<HTMLElement>;
186186
changeRef?: Directives.Ref<HTMLElement>;
187+
summaryRef?: Directives.Ref<HTMLElement>;
187188
}
188189

189190
type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
@@ -226,6 +227,7 @@ export class PatchWidget extends UI.Widget.Widget {
226227
}
227228
output.tooltipRef = output.tooltipRef ?? Directives.createRef<HTMLElement>();
228229
output.changeRef = output.changeRef ?? Directives.createRef<HTMLElement>();
230+
output.summaryRef = output.summaryRef ?? Directives.createRef<HTMLElement>();
229231

230232
function renderSourcesLink(): LitTemplate {
231233
if (!input.sources) {
@@ -358,7 +360,7 @@ export class PatchWidget extends UI.Widget.Widget {
358360
` : nothing}
359361
</div>
360362
` : nothing}
361-
<div class="apply-to-workspace-container">
363+
<div class="apply-to-workspace-container" aria-live="polite">
362364
${input.patchSuggestionState === PatchSuggestionState.LOADING ? html`
363365
<div class="loading-text-container">
364366
<devtools-spinner></devtools-spinner>
@@ -414,7 +416,7 @@ export class PatchWidget extends UI.Widget.Widget {
414416
</div>`
415417
: html`
416418
<details class="change-summary">
417-
<summary class="header-container">
419+
<summary class="header-container" ${Directives.ref(output.summaryRef)}>
418420
${renderHeader()}
419421
</summary>
420422
${renderContent()}
@@ -663,6 +665,12 @@ export class PatchWidget extends UI.Widget.Widget {
663665
Files:
664666
${processedFiles.map(filename => `* ${filename}`).join('\n')}`;
665667
this.requestUpdate();
668+
669+
if (this.#patchSuggestionState === PatchSuggestionState.SUCCESS) {
670+
void this.updateComplete.then(() => {
671+
this.#viewOutput.summaryRef?.value?.focus();
672+
});
673+
}
666674
}
667675

668676
#onDiscard(): void {

0 commit comments

Comments
 (0)