Skip to content

Highlight non-breaking whitespace in getByRole failure message #1314

Open
@ckundo

Description

@ckundo

When using getByRole, represent non-breaking whitespace in failure output as  , so that it's easier to diagnose the distinguish between " " and  . This would be in the list below "here are the accessible roles" under the "name" output.

Motivation: Non-breaking whitespace is not collapsed into " " in the accname calculation. This is correct according to the ARIA spec, but is tricky to debug getByRole failures related to usage of non-breaking whitespace. See also #904

Alternatives considered

We considered a custom helper to automatically collapse whitespace, but that is harder to maintain and discover than having the behavior in the core library. Further, it does not actually represent end-user experience since the browser does not perform this collapsing automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions