Skip to content

Commit f4736ac

Browse files
hi-ogawacodex
andcommitted
docs: clarify aria snapshot whitespace normalization
Co-authored-by: Codex <noreply@openai.com>
1 parent f87235f commit f4736ac

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/guide/browser/aria-snapshots.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ ARIA snapshots use a YAML-like syntax. Each line represents a node in the access
158158

159159
::: info
160160
ARIA snapshot templates use a **subset of YAML** syntax. Only the features needed for accessibility trees are supported: scalar values, nested mappings via indentation, and sequences (`- item`). Advanced YAML features like anchors, tags, flow collections, and multi-line scalars are not supported.
161+
162+
Captured text is also whitespace-normalized before it is rendered into the snapshot. Newlines, `<br>` line breaks, tabs, and repeated whitespace collapse to single spaces, so multi-line DOM text is emitted as a single-line snapshot value.
161163
:::
162164

163165
Each accessible element in the tree is represented as a YAML node:
@@ -206,6 +208,20 @@ Some content appears in the snapshot as a text node instead of a role-based elem
206208
- text: Hello world
207209
```
208210

211+
Text values are always serialized on a single line after whitespace normalization. For example:
212+
213+
```html
214+
<p>
215+
Line 1
216+
Line 2<br />Line 3
217+
Line 4
218+
</p>
219+
```
220+
221+
```yaml
222+
- paragraph: Line 1 Line 2 Line 3 Line 4
223+
```
224+
209225
### Children
210226

211227
Child elements appear nested under their parent:

0 commit comments

Comments
 (0)