You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/packages/dialog.md
+52-6Lines changed: 52 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,42 @@ dialog.open(
167
167
168
168
The service supports `v-model` prop updates — if your dialog emits `update:modelValue` events, the internal state stays in sync.
169
169
170
+
## Accessibility — Host ARIA Attributes
171
+
172
+
Native `<dialog>` elements need an accessible name (and usually a description) so screen readers announce more than a generic "dialog". `dialog.open()` accepts a third options arg that applies ARIA attributes directly to the host `<dialog>` element — your inner component does not need to walk `closest('dialog')` from a template ref.
173
+
174
+
```typescript
175
+
dialog.open(
176
+
ConfirmDialog,
177
+
{title: 'Delete user?', message: 'This action cannot be undone.'},
<!-- ConfirmDialog.vue — the ids match the host attributes above -->
184
+
<template>
185
+
<div>
186
+
<h2 id="confirm-dialog-title">{{ title }}</h2>
187
+
<p id="confirm-dialog-message">{{ message }}</p>
188
+
</div>
189
+
</template>
190
+
```
191
+
192
+
For dialogs without a visible title element, use `ariaLabel` instead:
193
+
194
+
```typescript
195
+
dialog.open(
196
+
IconOnlyDialog,
197
+
{
198
+
/* … */
199
+
},
200
+
{ariaLabel: 'Delete confirmation'},
201
+
);
202
+
```
203
+
204
+
All three options are independent and optional — pass any combination. Options omitted leave the corresponding attribute off the `<dialog>` element entirely (no empty-string attributes).
205
+
170
206
## API Reference
171
207
172
208
### `createDialogService()`
@@ -175,12 +211,22 @@ Returns a dialog service. No parameters.
0 commit comments