Skip to content

parseAriaTemplate throws on empty string input #16

@mayrang

Description

@mayrang

Problem

parseAriaTemplate('') throws an error:

Error: Aria snapshot must be a YAML sequence, elements starting with " -"

An empty string is a valid aria tree representation (e.g. when all content is aria-hidden="true"), so parseAriaTemplate should return an empty fragment node instead of throwing.

Context

This blocks the fix for vitest#10158 (toMatchAriaInlineSnapshot('') cannot match empty aria trees). The vitest-side fix (vitest-dev/vitest#10188) correctly distinguishes "" from undefined, but when the empty string reaches parseAriaTemplate, it throws.

Expected behavior

parseAriaTemplate('') should return { kind: 'role', role: 'fragment' } — an empty fragment with no children.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions