Skip to content

Spinner is inaccessible by default #3942

Description

@iansan5653

The Spinner component is, at first glance, a convenient way to render a loading state:

<Box>{isLoading ? <Spinner/> : content}</Box>

This appears straightforward, but in reality this is a bad idea because it's completely inaccessible. Spinner has no label by default, so the box will simply appear empty to screen readers.

The US Government CMS design system renders Spinner as a status with hidden "Loading" text. I think we probably should do the same by default, rendering it like so (hiding the SVG to avoid duplication):

<Boxrole="status"><VisuallyHidden>Loading</VisuallyHidden><SpinnerSvgaria-hidden/></Box>

This would make the accessible path much easier to follow.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions