-
-
Couldn't load subscription status.
- Fork 10.3k
Button to add preventDefault onClick if disabled #37784
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
Button to add preventDefault onClick if disabled #37784
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
| import { cloneElement, forwardRef, isValidElement } from 'react' | ||
| import { SIZE_VARIANTS, SIZE_VARIANTS_DEFAULT } from '../../lib/constants' | ||
| import { cn } from '../../lib/utils/cn' | ||
| import { IconContext } from '../Icon/IconContext' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
- Tested on preview
* ButtonTooltp to add preventDefault onClick if disabled * Update base component Button instead
Context
If Button is used with a link element (e.g
<Link>or<a>), users will still be redirected to the link upon clicking the button even if the button is disabled. The changes here should address that by preventing the redirect if the button is disabledAlthough do let me know if I might be overlooking something here! 🙏