Skip to content

Commit 563f142

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[AI Assistance] Focus change after discard
Fixed: 406078790 Change-Id: I85077f5a47c2403c0460f25812b6f3532cb21e54 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6436654 Auto-Submit: Nikolay Vitkov <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]>
1 parent 2e77b91 commit 563f142

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

front_end/panels/ai_assistance/PatchWidget.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export interface ViewInput {
159159

160160
export interface ViewOutput {
161161
tooltipRef?: Directives.Ref<HTMLElement>;
162+
changeRef?: Directives.Ref<HTMLElement>;
162163
}
163164

164165
type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
@@ -197,6 +198,7 @@ export class PatchWidget extends UI.Widget.Widget {
197198
return;
198199
}
199200
output.tooltipRef = output.tooltipRef ?? Directives.createRef<HTMLElement>();
201+
output.changeRef = output.changeRef ?? Directives.createRef<HTMLElement>();
200202

201203
function renderSourcesLink(): LitTemplate {
202204
if (!input.sources) {
@@ -320,9 +322,9 @@ export class PatchWidget extends UI.Widget.Widget {
320322
<devtools-button
321323
@click=${input.onChangeWorkspaceClick}
322324
.jslogContext=${'change-workspace'}
323-
.variant=${Buttons.Button.Variant.TEXT}>
324-
${lockedString(UIStringsNotTranslate.change)}
325-
</devtools-button>
325+
.variant=${Buttons.Button.Variant.TEXT}
326+
${Directives.ref(output.changeRef)}
327+
>${lockedString(UIStringsNotTranslate.change)}</devtools-button>
326328
</div>
327329
` : nothing}
328330
<div class="apply-to-workspace-container">
@@ -575,6 +577,9 @@ ${processedFiles.map(filename => `* ${filename}`).join('\n')}`;
575577
this.#patchSources = undefined;
576578
void this.changeManager?.popStashedChanges();
577579
this.requestUpdate();
580+
void this.updateComplete.then(() => {
581+
this.#viewOutput.changeRef?.value?.focus();
582+
});
578583
}
579584

580585
#onSaveAll(): void {

0 commit comments

Comments
 (0)