Dialog with description + actions and no children: text touches the footer rule

Aperta Adatta ai principianti
#1,329 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
design, frontend

Direzione di ricerca

Inizia da Dialog.svelte, il cui esempio nella documentazione usa lo stesso schema di titolo, descrizione e azioni, e controlla come vengono applicati gli stili al body e alla descrizione quando non ci sono children. Aggiungi un test di regressione che esegua il mount di questo caso e controlli la spaziatura prima delle azioni; il lavoro è completato quando lo spazio è almeno --ca-space-4 e il test passa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version: @codeatlasdev/ui 4.6.0 (seen in Atlas Desktop, WKWebView; headless WebKit shot)

What is wrong

A Dialog with title, description and actions but no children draws the description touching the footer rule: no space between the last line of the description and the border-top of .ca-dialog__actions (about 8px instead of the body's 16px + 16px padding). The empty .ca-dialog__body seems to collapse to 0 (flex: 0 1 auto; min-height: auto; overflow-y: auto in a height: fit-content panel).

Minimal repro

<Dialog bind:open title="Unpair Phone A3F9?" size="sm"
  description="It is disconnected at once and can no longer reach this computer. To use it again, scan a new code.">
  {#snippet actions()}
    <Button variant="ghost">Cancel</Button>
    <Button variant="destructive">Unpair</Button>
  {/snippet}
</Dialog>

A confirm dialog is the most common use of exactly this shape (the usage example in Dialog.svelte's own doc comment is the same: title + description + actions).

Expected vs actual

Expected: the same breathing room above the footer as a dialog that has a body. Actual: text against the rule.

Workaround in Atlas

PhoneRow.svelte passes the sentence as a child (<p>) instead of description, so the body has content. Only one call site today; if more confirms appear, a ConfirmDialog wrapper goes under apps/desktop/src/lib/components/.

Proposed fix

Render .ca-dialog__body only when children exist, and give .ca-dialog__description a bottom padding (var(--ca-space-4)) when there is no body, so the footer rule is never closer than the body padding. A regression test: mount a Dialog with description and actions and no children, assert the distance between the description's bottom and the actions' top is at least --ca-space-4.

Lingua principale
TypeScript
Stelle
6
Fork
3
Merge medio
5h 21m
PR unite (30g)
378

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codeatlasdev/ui

Tutte le issue di codeatlasdev/ui

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.