Commit ebd2df2
fix(Toast): announce title and description as text, not JSON (#2612)
The aria-live announcement region rendered `announceTextContent` (a
`string[]` returned by `getAnnounceTextContent`) directly with
`{{ … }}`. In Vue 3 that interpolation goes through `toDisplayString`,
which JSON-stringifies arrays:
isArray(val) ? JSON.stringify(val, replacer, 2) : ...
So a toast with a `ToastTitle` and a `ToastDescription` ended up being
announced as the literal string `[\n "Title",\n "Description"\n]`
instead of `Title Description`. The pattern was ported 1:1 from Radix
React, where `{children}` of a `string[]` happens to render as
concatenated text nodes.
Fix: render each chunk via `<template v-for>`, which preserves the
"natural pause break between nodes" the comment in `utils.ts` already
calls out as the intent.
Adds a regression test that asserts the live region's `textContent`
contains the toast title and does not contain JSON syntax characters.
Closes #2611
Co-authored-by: humanbird <27631243+humanbird@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 78efcf9 commit ebd2df2
2 files changed
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
44 | 69 | | |
45 | 70 | | |
46 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
187 | 200 | | |
188 | 201 | | |
189 | 202 | | |
| |||
0 commit comments