Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/loader-aria-accessibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@cloudflare/kumo": patch
---

fix(loader): add ARIA attributes for screen reader accessibility

Added `role="status"` and `aria-label="Loading"` to the Loader SVG component to make it accessible to screen readers. This resolves a WCAG 2.1 SC 4.1.3 (Status Messages) violation where assistive technology users received no indication that content was loading.
9 changes: 9 additions & 0 deletions packages/kumo/src/components/loader/loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export interface LoaderProps {
* @default "base"
*/
size?: KumoLoaderSize | number;
/**
* Accessible label for the loader, announced by screen readers.
* Pass a translated string for internationalization.
* @default "Loading"
*/
"aria-label"?: string;
}

/**
Expand All @@ -75,6 +81,7 @@ export interface LoaderProps {
export const Loader = ({
className,
size = KUMO_LOADER_DEFAULT_VARIANTS.size,
"aria-label": ariaLabel = "Loading",
}: LoaderProps) => {
const sizeValue = loaderVariants({ size });
return (
Expand All @@ -86,6 +93,8 @@ export const Loader = ({
stroke="currentColor"
className={className}
style={{ height: sizeValue, width: sizeValue }}
role="status"
aria-label={ariaLabel}
>
<circle
cx="12"
Expand Down
Loading