fix(loader): add aria attributes for screen reader accessibility#46
fix(loader): add aria attributes for screen reader accessibility#46stritt merged 8 commits intocloudflare:mainfrom
Conversation
commit: |
Docs PreviewCommit: |
|
/bonk please update code based on this comment className={className} afterwards review code and provide feedback |
There was a problem hiding this comment.
Thanks for this accessibility improvement! Adding role="status" is definitely the right approach for WCAG 4.1.3 compliance.
I agree with @mattrothenberg's suggestion about making aria-label a prop with a default value of "Loading". This would allow consumers to pass translated strings for internationalization support, which is important for a design system component.
Suggested approach:
export interface LoaderProps {
/** Accessible label for screen readers. @default "Loading" */
'aria-label'?: string;
// ... existing props
}
export const Loader = ({
className,
size = KUMO_LOADER_DEFAULT_VARIANTS.size,
'aria-label': ariaLabel = 'Loading',
}: LoaderProps) => {
// ...
<svg
role="status"
aria-label={ariaLabel}
// ...
>This maintains backward compatibility while enabling i18n. Once that's addressed, this should be good to merge!
|
✅ Review submitted for PR #46 The review acknowledges this is a valuable accessibility improvement for WCAG 2.1 compliance. I agreed with @mattrothenberg's existing feedback about making Summary of feedback:
Once the author addresses the i18n suggestion, this PR should be ready to merge. |
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
This reverts commit b9759e0.






Description
role="status"andaria-label="Loading"to the Loader SVG componentProblem
The Loader component renders an SVG spinner without any accessibility attributes, making it completely invisible to screen readers. When used as a loading indicator (e.g., in buttons, page transitions, async operations), assistive technology users receive no indication that content is loading.
Screen readers skip over the Loader entirely - users hear nothing.
Solution
Add two ARIA attributes to the SVG element:
role="status"- Indicates this is a live region for status updatesaria-label="Loading"- Provides the accessible name announced by screen readersScreen readers announce "Loading, status" when the Loader is present.
Testing
Verified with VoiceOver on macOS: