Skip to content
Open
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
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-03-02 - [Button Loading State Accessibility]
**Learning:** Loading states on reusable buttons (like `src/components/ui/button.tsx`) can be noisy for screen readers if the spinning icon isn't hidden.
**Action:** Always add `aria-hidden="true"` to decorative loader icons (like `Loader2`) and `aria-busy={isLoading}` to the parent `<button>` to correctly communicate the loading state to screen readers without announcing the icon itself.
3 changes: 2 additions & 1 deletion src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(

const content = showLoader ? (
<>
<Loader2 className="animate-spin" />
<Loader2 className="animate-spin" aria-hidden="true" />
{children}
</>
) : (
Expand All @@ -45,6 +45,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
disabled={isLoading || props.disabled}
aria-busy={isLoading}
onClick={handleClick}
{...props}
>
Expand Down
Loading