ui icon indicating copy to clipboard operation
ui copied to clipboard

[feat]: add `aria-disabled` to button component

Open huilensolis opened this issue 1 year ago • 1 comments

Feature description

the button component should add the aria disabled, when the disabled metatag is active.

example:

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
+ ({ className, variant, size, asChild = false, disabled = false, ...props }, ref) => {
    const Comp = asChild ? Slot : "button"
    return (
      <Comp
        className={cn(buttonVariants({ variant, size, className }))}
        ref={ref}
+       disabled={disabled}
+       aria-disabled={disabled}
        {...props}
      />
    )
  }
)```

### Affected component/components

Button

### Additional Context

Additional details here...

### Before submitting

- [X] I've made research efforts and searched the documentation
- [X] I've searched for existing issues and PRs

huilensolis avatar Mar 06 '24 01:03 huilensolis

This prop can be controlled from the caller side. ie. <Button aria-disabled={true} />

Aria-disabled and disabled do not server the exact same use-cases so hardcoding them to be the same values is not a good choice in my opinion.

kevinmitch14 avatar Mar 07 '24 17:03 kevinmitch14

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jun 10 '24 23:06 shadcn