Skip to content

Commit 162520c

Browse files
committed
chore: ensure enter key doesnt dismiss dialog
1 parent 13ac09b commit 162520c

1 file changed

Lines changed: 51 additions & 47 deletions

File tree

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,59 @@
1-
<h2 mat-dialog-title>Post Attachment?</h2>
2-
<mat-dialog-content>
3-
<p>This attachment is ready to post as a task comment.</p>
1+
<div (keydown.enter)="$event.preventDefault(); $event.stopPropagation()">
2+
<h2 mat-dialog-title>Post Attachment?</h2>
3+
<mat-dialog-content>
4+
<p>This attachment is ready to post as a task comment.</p>
45

5-
<div
6-
class="mx-auto flex min-h-[180px] w-full max-w-[520px] items-center justify-center overflow-hidden rounded-xl bg-black/5"
7-
>
8-
@if (isImage) {
9-
<img
10-
class="aspect-square w-full max-w-[520px] object-contain object-center"
11-
[alt]="file.name"
12-
[src]="previewUrl"
13-
/>
14-
} @else if (isPdf) {
15-
<div class="flex items-center gap-2 p-3">
16-
<mat-icon class="size-5 text-[2rem]">picture_as_pdf</mat-icon>
17-
<div class="flex flex-col gap-px break-all">
18-
<strong>{{ file.name }}</strong>
19-
<span>PDF document</span>
20-
</div>
21-
</div>
22-
} @else if (isAudio) {
23-
<div class="w-full p-3">
24-
<div class="flex items-center gap-2">
25-
<mat-icon class="size-5 text-[2rem]">audio_file</mat-icon>
6+
<div
7+
class="mx-auto flex min-h-[180px] w-full max-w-[520px] items-center justify-center overflow-hidden rounded-xl bg-black/5"
8+
>
9+
@if (isImage) {
10+
<img
11+
class="aspect-square w-full max-w-[520px] object-contain object-center"
12+
[alt]="file.name"
13+
[src]="previewUrl"
14+
/>
15+
} @else if (isPdf) {
16+
<div class="flex items-center gap-2 p-3">
17+
<mat-icon class="size-5 text-[2rem]">picture_as_pdf</mat-icon>
2618
<div class="flex flex-col gap-px break-all">
2719
<strong>{{ file.name }}</strong>
28-
<span>{{ file.type || 'Audio file' }}</span>
20+
<span>PDF document</span>
21+
</div>
22+
</div>
23+
} @else if (isAudio) {
24+
<div class="w-full p-3">
25+
<div class="flex items-center gap-2">
26+
<mat-icon class="size-5 text-[2rem]">audio_file</mat-icon>
27+
<div class="flex flex-col gap-px break-all">
28+
<strong>{{ file.name }}</strong>
29+
<span>{{ file.type || 'Audio file' }}</span>
30+
</div>
2931
</div>
32+
<audio class="mt-2.5 w-full" controls [src]="previewUrl"></audio>
3033
</div>
31-
<audio class="mt-2.5 w-full" controls [src]="previewUrl"></audio>
32-
</div>
33-
} @else {
34-
<div class="flex items-center gap-2 p-3">
35-
<mat-icon class="size-5 text-[2rem]">attach_file</mat-icon>
36-
<div class="flex flex-col gap-px break-all">
37-
<strong>{{ file.name }}</strong>
38-
<span>{{ file.type || 'Attachment' }}</span>
34+
} @else {
35+
<div class="flex items-center gap-2 p-3">
36+
<mat-icon class="size-5 text-[2rem]">attach_file</mat-icon>
37+
<div class="flex flex-col gap-px break-all">
38+
<strong>{{ file.name }}</strong>
39+
<span>{{ file.type || 'Attachment' }}</span>
40+
</div>
3941
</div>
40-
</div>
41-
}
42-
</div>
42+
}
43+
</div>
4344

44-
<p class="mt-2 text-base break-all opacity-80">
45-
{{ file.name }}
46-
@if (file.size) {
47-
<span>({{ formatFileSize(file.size) }})</span>
48-
}
49-
</p>
50-
</mat-dialog-content>
45+
<p class="mt-2 text-base break-all opacity-80">
46+
{{ file.name }}
47+
@if (file.size) {
48+
<span>({{ formatFileSize(file.size) }})</span>
49+
}
50+
</p>
51+
</mat-dialog-content>
5152

52-
<mat-dialog-actions align="end">
53-
<button mat-button (click)="dismiss(false)">Cancel</button>
54-
<button color="primary" mat-raised-button (click)="dismiss(true)">Post Attachment</button>
55-
</mat-dialog-actions>
53+
<mat-dialog-actions align="end">
54+
<button mat-button type="button" (click)="dismiss(false)">Cancel</button>
55+
<button color="primary" mat-raised-button type="button" (click)="dismiss(true)">
56+
Post Attachment
57+
</button>
58+
</mat-dialog-actions>
59+
</div>

0 commit comments

Comments
 (0)