feat(ui): standardize dialog widths with tiered size system (sm/md/lg)

Add three reusable size tier classes (app-dialog-sm, app-dialog-md,
app-dialog-lg) to base dialog CSS, replacing per-variant max-width
rules. Each tier uses width: min(Xrem, calc(100vw - 2rem)) for
consistent fixed widths with responsive mobile fallback.

- Confirm dialog + session warning: app-dialog-sm (24rem)
- Bookmark + bookmark group dialog: app-dialog-md (32rem)
- Remove max-width from app-confirm-dialog.css and app-bookmark-form.css

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 10:48:12 +01:00
parent 7a222f0b1f
commit 6ea3c2b88c
6 changed files with 16 additions and 13 deletions

View File

@@ -51,7 +51,7 @@ $iconLabels = [
data-url-preview-label="<?php e(t('Bookmarking this page:')); ?>"
aria-labelledby="app-bookmark-dialog-title"
>
<article class="app-bookmark-dialog">
<article class="app-bookmark-dialog app-dialog-md">
<header>
<h2 id="app-bookmark-dialog-title"><?php e(t('Add bookmark')); ?></h2>
<button type="button" class="close" data-bookmark-dialog-close aria-label="<?php e(t('Close')); ?>" title="<?php e(t('Close')); ?>"></button>
@@ -101,7 +101,7 @@ $iconLabels = [
data-msg-name-required="<?php e(t('Group name is required')); ?>"
aria-labelledby="app-bookmark-group-dialog-title"
>
<article class="app-bookmark-dialog app-bookmark-group-dialog">
<article class="app-bookmark-dialog app-bookmark-group-dialog app-dialog-md">
<header>
<h2 id="app-bookmark-group-dialog-title"><?php e(t('New group')); ?></h2>
<button type="button" class="close" data-bookmark-group-dialog-close aria-label="<?php e(t('Close')); ?>" title="<?php e(t('Close')); ?>"></button>

View File

@@ -3,11 +3,6 @@
* Styles for bookmark and bookmark-group dialogs.
*/
@layer components {
dialog[data-app-bookmark-dialog] > article.app-bookmark-dialog,
dialog[data-app-bookmark-group-dialog] > article.app-bookmark-dialog {
max-width: 24rem;
}
dialog[data-app-bookmark-dialog] > article.app-bookmark-dialog > header,
dialog[data-app-bookmark-group-dialog] > article.app-bookmark-dialog > header {
position: relative;

View File

@@ -7,7 +7,7 @@
aria-labelledby="app-confirm-dialog-title"
aria-describedby="app-confirm-dialog-message"
>
<article class="app-confirm-dialog">
<article class="app-confirm-dialog app-dialog-sm">
<header>
<h2 id="app-confirm-dialog-title" data-app-confirm-title><?php e(t('Please confirm')); ?></h2>
<button type="button" class="close" data-app-confirm-close aria-label="<?php e(t('Close')); ?>" title="<?php e(t('Close')); ?>"></button>

View File

@@ -5,7 +5,7 @@
aria-describedby="app-session-warning-message"
aria-live="assertive"
>
<article class="app-session-warning-dialog">
<article class="app-session-warning-dialog app-dialog-sm">
<header>
<h2 id="app-session-warning-title"><?php e(t('Session expiring')); ?></h2>
</header>

View File

@@ -1,9 +1,5 @@
@layer components {
/* Confirm dialog — modal overlay for destructive action confirmation with danger/warning variants. */
dialog[data-app-confirm-dialog] > article.app-confirm-dialog {
max-width: 32rem;
}
dialog[data-app-confirm-dialog] > article.app-confirm-dialog > header {
position: relative;
padding-inline-end: 2rem;

View File

@@ -5,6 +5,18 @@
* Variant-specific styles live in their own component files (app-confirm-dialog.css, etc.).
*/
@layer components {
/* ── Size tiers ────────────────────────────────────────────────────────
* Fixed-width tiers so every dialog of the same purpose feels consistent.
* Apply one of these classes to the <article> inside <dialog>.
* sm (24rem) — simple prompts, confirmations, alerts
* md (32rem) — form dialogs with 1-3 fields, pickers
* lg (40rem) — complex forms, multi-section dialogs
* min() ensures graceful shrink on narrow viewports.
* ──────────────────────────────────────────────────────────────────── */
dialog > article.app-dialog-sm { width: min(24rem, calc(100vw - 2rem)); }
dialog > article.app-dialog-md { width: min(32rem, calc(100vw - 2rem)); }
dialog > article.app-dialog-lg { width: min(40rem, calc(100vw - 2rem)); }
/* ── Footer layout ───────────────────────────────────────────────────── */
dialog > article > footer,
dialog > article form > footer {