Skip to content

Commit 86de438

Browse files
committed
chat message example
1 parent 9557e57 commit 86de438

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/content/blog/2025-11-aria-live.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ Consider this example:
187187

188188
For most status messages and notifications, `aria-atomic="true"` provides better context.
189189

190+
For chat messages, you'd typically use `aria-live="polite"` with `aria-atomic="false"` so each new message is announced individually without interrupting the user:
191+
192+
```html
193+
<!-- Chat messages example -->
194+
<div aria-live="polite" aria-atomic="false">
195+
<div>Alice: Hello!</div>
196+
<div>Bob: Hi there!</div>
197+
<!-- Only "Bob: Hi there!" gets announced when added -->
198+
</div>
199+
```
200+
190201
In short:
191202
- **`aria-live`** defines *when* to speak (or not at all with `off`)
192203
- **`aria-relevant`** defines *what* to speak

0 commit comments

Comments
 (0)