Skip to content

Commit

Permalink
restore focus
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 authored and peggimann committed Nov 6, 2024
1 parent 3aadf01 commit a03900a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<h2 class="title fit-content">{{ objective.title }}</h2>
</section>
<button
#menuButton
*ngIf="isWritable"
class="icon-button three-dot-menu focus-outline"
[matMenuTriggerFor]="objectiveMenu"
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/app/components/objective/objective.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { ObjectiveMin } from '../../shared/types/model/ObjectiveMin';
import { Router } from '@angular/router';
import { map, ReplaySubject } from 'rxjs';
Expand All @@ -10,6 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
import { DialogService } from '../../services/dialog.service';
import { ObjectiveMenuActionsService, ObjectiveMenuEntry } from '../../services/objective-menu-actions.service';
import { State } from '../../shared/types/enums/State';
import { MatMenuTrigger } from '@angular/material/menu';

@Component({
selector: 'app-objective-column',
Expand All @@ -21,6 +22,7 @@ export class ObjectiveComponent implements OnInit {
public objective$ = new ReplaySubject<ObjectiveMin>();
menuEntries = this.objective$.pipe(map((objective) => this.objectiveMenuActionsService.getMenu(objective)));
protected readonly trackByFn = trackByFn;
@ViewChild(MatMenuTrigger) trigger: MatMenuTrigger | undefined;

constructor(
private readonly dialogService: DialogService,
Expand All @@ -47,6 +49,7 @@ export class ObjectiveComponent implements OnInit {
matDialogRef.afterClosed().subscribe((result) => {
this.objectiveService.getFullObjective(objectiveMin.id).subscribe((objective) => {
menuEntry.afterAction(objective, result);
this.trigger?.focus();
});
});
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/services/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface ConfirmDialogData {
export class DialogService {
DIALOG_CONFIG = {
panelClass: 'okr-dialog-panel',
restoreFocus: true,
maxWidth: '100vw',
};

Expand Down

0 comments on commit a03900a

Please sign in to comment.