Skip to content

Commit

Permalink
Merge pull request #43 from qupaya/at/feature/dialog-overlay-handling
Browse files Browse the repository at this point in the history
fix: stop propagation on dialog escape
  • Loading branch information
BaggersIO authored Aug 12, 2024
2 parents 199074f + 5490883 commit ca4c7b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#dialogElement
skClickBackdrop
(clickedBackdrop)="close.emit()"
(keydown.escape)="close.emit()"
(keydown.escape)="handleEscape($event)"
[class.display-flex]="open()"
>
<div
Expand Down
7 changes: 7 additions & 0 deletions libs/sketch/src/lib/components/dialog/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ export class DialogComponent {
},
{ allowSignalWrites: true }
);

handleEscape(event: Event): void {
this.close.emit();

event.preventDefault();
event.stopImmediatePropagation();
}
}

0 comments on commit ca4c7b6

Please sign in to comment.