Skip to content

Commit 37ba5ac

Browse files
committed
review: dedicated empty state + focus-visible on close affordances
- The "no recipients" path previously set `status = 'error'` and stuffed the empty-state copy into `errorMessage`, so the modal rendered "Could not load preview." followed by "No recipients to preview." — two conflicting messages. Add a distinct `'empty'` status and render the empty copy on its own. - Add `:focus-visible` outlines on `.close-btn` and `.backdrop-close` so keyboard users get a visible focus indicator on the only two interactive elements outside the content body.
1 parent acc5258 commit 37ba5ac

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/lib/components/filesharing/EmailPreviewModal.svelte

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
3939
let { uuid, onClose }: Props = $props()
4040
41-
type Status = 'loading' | 'ready' | 'error'
41+
type Status = 'loading' | 'ready' | 'empty' | 'error'
4242
let status: Status = $state('loading')
4343
let errorMessage = $state('')
4444
let data = $state<PreviewResponse | null>(null)
@@ -70,8 +70,7 @@
7070
}
7171
data = (await res.json()) as PreviewResponse
7272
if (allEmails.length === 0) {
73-
status = 'error'
74-
errorMessage = $_('filesharing.emailPreview.empty')
73+
status = 'empty'
7574
return
7675
}
7776
status = 'ready'
@@ -126,6 +125,8 @@
126125
<p>{$_('filesharing.emailPreview.error')}</p>
127126
<p class="error-detail">{errorMessage}</p>
128127
</div>
128+
{:else if status === 'empty'}
129+
<div class="state">{$_('filesharing.emailPreview.empty')}</div>
129130
{:else if active}
130131
<section class="meta">
131132
<div class="meta-row">
@@ -264,6 +265,12 @@
264265
color: var(--pg-text);
265266
}
266267
268+
.close-btn:focus-visible,
269+
.backdrop-close:focus-visible {
270+
outline: 2px solid var(--pg-text);
271+
outline-offset: 2px;
272+
}
273+
267274
.meta {
268275
display: flex;
269276
flex-direction: column;

0 commit comments

Comments
 (0)