Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]: add aria-disabled to button component #2917

Closed
huilensolis opened this issue Mar 6, 2024 · 2 comments · May be fixed by #2921
Closed

[feat]: add aria-disabled to button component #2917

huilensolis opened this issue Mar 6, 2024 · 2 comments · May be fixed by #2921

Comments

@huilensolis
Copy link

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
@kevinmitch14
Copy link
Contributor

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.

@shadcn shadcn added the Stale label Jun 3, 2024
@shadcn
Copy link
Collaborator

shadcn commented Jun 10, 2024

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 shadcn closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants