feat(editor): dialog close button is a 44 px touch box

This commit is contained in:
bchanot committed 2026-11-15 19:40:46 +01:00
1 parent ae02f48853
commit 240c2ba0e7
4 files changed
+79 -5

No files matched your search

+19 -4
View File
@@ -30,8 +30,23 @@ const SIZE: Record<NonNullable<DialogProps['size']>, string> = {
xl: 'max-w-4xl',
}
/** The title; `outline-none`: only a script focuses it (`titleId`), never a key. */
const TITLE = 'text-lg font-semibold text-[var(--color-ink)] outline-none'
/**
* The title; `outline-none`: only a script focuses it (`titleId`), never a key. A long
* one wraps (`min-w-0 break-words`) and never pushes the ✕ out.
*/
const TITLE =
'min-w-0 break-words text-lg font-semibold text-[var(--color-ink)] outline-none'
/** The ✕'s 44 px box sets the header's height: its padding stays small. */
const HEADER =
'flex items-center justify-between gap-2 border-b border-[var(--color-border)] ' +
'py-1 pl-4 pr-1 sm:py-2 sm:pl-6 sm:pr-3'
/** The ✕: a 44 × 44 px touch box, as MobileDrawer's close (Rev 6). */
const CLOSE =
'grid h-11 w-11 shrink-0 place-items-center rounded-lg ' +
'text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-strong)] ' +
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]'
export default function Dialog({ open, ...surface }: DialogProps) {
return (
@@ -79,7 +94,7 @@ function DialogSurface({
transition={{ duration: reduced ? 0 : 0.18 }}
className={`relative w-full ${SIZE[size]} max-h-[85vh] overflow-y-auto overscroll-contain rounded-2xl bg-[var(--color-surface)] shadow-xl`}
>
<header className="flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-[var(--color-border)]">
<header className={HEADER}>
<h2
id={titleId ?? ownTitleId}
tabIndex={titleId ? -1 : undefined}
@@ -91,7 +106,7 @@ function DialogSurface({
type="button"
aria-label={t('common.close')}
onClick={onClose}
className="rounded-md p-1 text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-strong)]"
className={CLOSE}
>
✕
</button>