feat(ui): modal dialogs on the native dialog element (D13)
ModalDialog wraps showModal(): the page behind is inert and does not scroll, focus starts on the first control and returns to the opener, or to the first control of its nearest container when the opener is gone. Escape and close requests only ask the consumer. Dialog gains aria-labelledby and an optional described message; the confirmations pass theirs. The mobile drawer uses the same primitive and closes at the sidebar breakpoint.
This commit is contained in:
1 parent
57922e0902
commit
6f885eccb2
9 files changed
+450
-118
No files matched your search
@@ -18,13 +18,11 @@ export default function DisclaimerDialog({
|
||||
open
|
||||
onClose={onAcknowledge}
|
||||
title={t('editor.disclaimer_title')}
|
||||
description={<p className="text-sm text-[var(--color-ink)]">{text}</p>}
|
||||
size="md"
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-[var(--color-ink)]">{text}</p>
|
||||
<div className="flex justify-end">
|
||||
<Button onClick={onAcknowledge}>{t('common.understood')}</Button>
|
||||
</div>
|
||||
<div className="mt-4 flex justify-end">
|
||||
<Button onClick={onAcknowledge}>{t('common.understood')}</Button>
|
||||
</div>
|
||||
</Dialog>
|
||||
)
|
||||
|
||||
@@ -114,15 +114,17 @@ export default function HeldSessionPanel({
|
||||
? 'session.held.open_title'
|
||||
: `session.held.discard_title_${pending?.action === 'discard' ? pending.text : 'draft'}`,
|
||||
)}
|
||||
description={
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t(
|
||||
pending?.action === 'open'
|
||||
? 'session.held.open_body'
|
||||
: 'session.held.discard_body',
|
||||
)}
|
||||
</p>
|
||||
}
|
||||
size="sm"
|
||||
>
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t(
|
||||
pending?.action === 'open'
|
||||
? 'session.held.open_body'
|
||||
: 'session.held.discard_body',
|
||||
)}
|
||||
</p>
|
||||
<div className="mt-4 flex justify-end gap-2">
|
||||
<Button type="button" variant="ghost" onClick={() => setPending(null)}>
|
||||
{t('common.cancel')}
|
||||
|
||||
@@ -30,8 +30,13 @@ export default function ReplaceSessionDialog({
|
||||
? t('session.replace.body').replace(/\{animal\}/, () => report.animal.name)
|
||||
: t('session.replace.body_unloaded')
|
||||
return (
|
||||
<Dialog open={open} onClose={onCancel} title={t('session.replace.title')} size="sm">
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">{body}</p>
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={onCancel}
|
||||
title={t('session.replace.title')}
|
||||
description={<p className="text-sm text-[var(--color-ink-muted)]">{body}</p>}
|
||||
size="sm"
|
||||
>
|
||||
{unsaved && (
|
||||
<div className="mt-3 space-y-2">
|
||||
<p className="text-sm">{t('session.replace.unsaved')}</p>
|
||||
|
||||
Reference in new issue
Block a user