-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
disabled prop does not work for Button and Radio despite the type allowing it #7269
Comments
This change occurred 6 days ago ( <chakra.button
- disabled={isDisabled || isLoading}
ref={useMergeRefs(ref, _ref)}
as={as}
type={type ?? defaultType}
data-active={dataAttr(isActive)}
data-loading={dataAttr(isLoading)}
__css={buttonStyles}
className={cx("chakra-button", className)}
{...rest}
+ disabled={isDisabled || isLoading}
> I can't make any comments on this change, but I know that before this change, you could use both <Button isLoading disabled={false}>
Button
</Button> |
i have the same issue |
I'd be happy to create a PR but first I'd need a comment from maintainers whether I should update the functionality (i.e. make |
I noticed was disabled prop was changed in many components :/ |
I noticed this issue as well. It seems the |
+1 |
Yeah, this is a breaking change that was called a "refactor" #7233 |
This is the actual commit: 0f37665 |
Here is the original issue that prompted the change: #7243 |
@RobinClowers Great you found the original issue, but I think it needs to be better handled not to confuse people. Shouldn't be two props that are doing the same thing. I'm curious why were two and |
The |
According to this comment it's the typings which should be updated, but @segunadebayo can you confirm it? |
Is this not a concern? I get that the surface area for breaking changes in a component library like this is massive and difficult to pin down, but since this was included in the types, I feel it's reasonable to consider this a breaking change. Edit: sorry, I just now peeked at #7243 — I imagine enforcing consistency there is more important than breaking our less standard use case 😑. |
Not sure what % of users will be hit by this, but my feeling is that this issue is urgent and will blow up further when more users try to upgrade and notice (or not notice) that |
Presently, the only ways to disable a button is with an "isLoading" or "isDisabled" prop. |
Just got caught out by this. The type supporting the |
@segunadebayo I believe this is not only related to TypeScript, as it's a breaking change from previous behavior. |
@segunadebayo I agree with @JulioC, even though I would like to make PR, I don't know what was intended to be not using the typical flag |
For reference, this is the commit which changed this behavior: 0f37665 The original issue motivating the change: #7243 I believe either solutions are acceptable (I prefer the first one):
|
Yeah 'disabled' is not working for me right now, only 'isDisabled' prop is working |
i had the same issue with "Disabled" prop, but with "isDisabled" prop worked fine |
I think it makes sense both ways. Since |
Is there any plan to fix this or at least get rid of |
Got confused about why p.s. |
For me it still does not work even with isDisabled=true |
I updated chakra recently to latest and all my integration tests that were expecting disabled buttons started failing :|. Found out I had to use |
It's just working with isDisabled here. |
For me also same issue , tried both disabled and isDisabled both didn't work. I am using the below version.
|
Why changing public API is in fix?.. This is a BREAKING change btw |
|
@servettonga Look at Props. |
Thanks, I didn't notice that |
It means that Chakra desactivated That's kind of dangerous as all my company code was using |
I think I've stumbled on to why it's not caught by the linter. I believe that the linter/typescript is conflating the Chakra UI props with the React.Button (really any input, though). This looks like it's by design, since each Chakra component extends |
This is not only a breaking change, it also makes working around the accessibility problem described in #7965 impossible. @segunadebayo what is the status on this – any possibility to revert 0f37665 or can you kindly advise how the issues raised in this thread can be worked around? |
thanks |
Checkout this chakra issue : chakra-ui/chakra-ui#7269 For some reasons, disabling button worked at the start of this project with the "disabled" props and do not anymore... Damn you chakra !
Didn't realize there was so much discussion on this particular page (already commented in two other spots). Can we please do something for this? Maybe the assumption now is everyone updated already, but we were behind on Chakra and got hit with this recently, ending up causing a big mess of things like duplicate transactions in production from double-clicks on submission buttons that no longer disabled on the first click (@lakardion smart to check disabled state in your automated tests.. we will from now on). If it isn't going to be reverted, let's do what @grzmot22 's issue suggests and just remove disabled from the typescript type. At least then we would have had a compilation error when doing the update and realized immediately the change. And I think @jrolfs could still work around this for their use-case by using ref to add the disabled property directly in the dom. |
If that is done, it will manifest the current situation – which means the workaround for is no longer possible #7965 (we need to ensure |
I'm in love with chakra but this button styling mess and now this makes it so painful to use |
This reverts commit 0f37665. Fixes chakra-ui#7269, chakra-ui#7816 and chakra-ui#7905 and also enables the only currently known workaround for chakra-ui#7965. Removing the ability to use the disabled-prop posed a breaking change, which is hereby fixed.
* Revert "refactor: button disabled prop" This reverts commit 0f37665. Fixes #7269, #7816 and #7905 and also enables the only currently known workaround for #7965. Removing the ability to use the disabled-prop posed a breaking change, which is hereby fixed. * docs: update --------- Co-authored-by: Segun Adebayo <joseshegs@gmail.com>
@grzmot22 #8462 has been merged, Kindly also check if the prop works as desired on Radio as well – in my tests it seems to work again (at least visually). If satisfied, kindly close this issue, the fix should be shipping with Chakra 2.8.3. |
Description
The type for Button and Radio allows both the disabled and isDisabled props, but only isDisabled works. disabled will be silently ignored with no warning whatsoever.
Please fix this by either changing the type so disabled is no longer a prop of Button, Radio or making it so that disabled works.
Link to Reproduction
https://codesandbox.io/s/intelligent-jang-wu06rc
Steps to reproduce
Chakra UI Version
2.4.9
Browser
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: