Imported from LilyDesignSystem/lily-design-system (
lilydesignsystem.github.io/src/routes/components/dialog/AGENTS.md). Install upstream withnpx skills add LilyDesignSystem/lily-design-system --skill dialog. Copyright stays with the author.
Dialog
Metadata
- Component: dialog
- PascalCase: Dialog
- Description: a modal or non-modal dialog window
- HTML tag:
- CSS class: .dialog
- Interactive: yes
Key Behaviors
- Renders a native
<dialog>element conditionally via conditional rendering - Supports two-way binding on the
openprop with the parent - The
openHTML attribute is set directly on the dialog element (not using.showModal()) tabindex="-1"is set on the dialog to ensure it can receive focus and keyboard events- Escape key handler sets
opento false and prevents default browser behavior - The
modalprop controls whetheraria-modalis set (defaults to true) - When
modalis false,aria-modalis omitted entirely (set toundefined) - Accepts a
childrenslot for dialog content including buttons, forms, or text - Spreads
restPropsonto the<dialog>element for consumer customization
ARIA
role="dialog"-- provided natively by the<dialog>elementaria-label="{label}"-- provides an accessible name for the dialogaria-modal="true"-- present when themodalprop is true, indicating the dialog traps focus and blocks background interactiontabindex="-1"-- allows the dialog element itself to receive focus for keyboard event handling
Keyboard
- Escape: closes the dialog by setting
opento false
Props
open: boolean (default: false) -- whether the dialog is visible; bindablelabel: string (required) -- accessible name for the dialogmodal: boolean (default: true) -- whether the dialog behaves as a modalchildren: slot (required) -- dialog body content
Acceptance Criteria
- Renders element with class="dialog"
- Has aria-label attribute
- Has role="dialog"
- Keyboard navigation works correctly
- WCAG 2.2 AAA compliant
- Zero CSS — fully headless
References
- Documentation: index.md
- CSS class: .dialog in css-style-sheet-template.css
- HTML headless: lily-design-system-html-headless/components/dialog.html
- WAI-ARIA Dialog Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
- MDN dialog element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
- WAI-ARIA dialog role: https://www.w3.org/TR/wai-aria-1.2/#dialog