Skeleton accessibility
WCAG 2.1 AA requirements
Hidden from assistive tech
- Skeleton renders with
aria-hidden, so screen readers skip it entirely. The pulsing animation is a visual cue only. - The actual content, once loaded, replaces the skeleton and is announced normally.
Announcing loading state
- Skeleton itself does not announce "loading" to screen readers. If you need to communicate a loading state, add an
aria-busy="true"on the container and anaria-live="polite"region that announces when content is ready. - Example pattern:
<div aria-busy={isLoading} aria-live="polite">
{isLoading ? (
<Skeleton className="h-4 w-48" />
) : (
<p>{content}</p>
)}
</div>Reduced motion
- The pulse animation respects
prefers-reduced-motionthrough Tailwind'sanimate-pulseutility. When reduced motion is preferred, the animation is suppressed by the user agent.
Contrast
- Skeleton uses
bg-muted, a subtle grey that is visible againstbg-backgroundwithout being distracting.
Audit checklist
-
aria-hiddenon the skeleton element - Container has
aria-busywhen loading -
aria-liveregion announces content when ready - Pulse animation respects reduced motion preference