Decouple dialog refocus from PanelsService via FocusService
Dialogs only needed refocus(); injecting PanelsService boots a whole workspace, which secondary windows must not do. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Component, ElementRef, afterNextRender, inject, input, viewChild } from '@angular/core';
|
||||
import { DialogsService, type ConfirmRequest } from '../dialogs.service';
|
||||
import { PanelsService } from '../panels.service';
|
||||
import { FocusService } from '../focus.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm-dialog',
|
||||
@@ -41,7 +41,7 @@ export class ConfirmDialog {
|
||||
|
||||
private readonly confirmBtn = viewChild.required<ElementRef<HTMLButtonElement>>('confirmBtn');
|
||||
private readonly dialogs = inject(DialogsService);
|
||||
private readonly panels = inject(PanelsService);
|
||||
private readonly focus = inject(FocusService);
|
||||
|
||||
constructor() {
|
||||
afterNextRender(() => this.confirmBtn().nativeElement.focus());
|
||||
@@ -59,6 +59,6 @@ export class ConfirmDialog {
|
||||
|
||||
private close(): void {
|
||||
this.dialogs.confirm.set(null);
|
||||
this.panels.refocus();
|
||||
this.focus.bump();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user