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

React Listbox disabled button props type bug v1.7.12 #2327

Closed
odeyal0 opened this issue Mar 2, 2023 · 3 comments · Fixed by #2329
Closed

React Listbox disabled button props type bug v1.7.12 #2327

odeyal0 opened this issue Mar 2, 2023 · 3 comments · Fixed by #2329
Assignees

Comments

@odeyal0
Copy link

odeyal0 commented Mar 2, 2023

Problems with type for Listbox.Button "disabled" property.
(v1.7.11 it's OK)

Example:
https://codesandbox.io/s/headless-ui-listbox-disabled-button-bug-gzlo5b?file=/src/App.tsx

Error:

Type '{ children: Element[]; disabled: true; className: string; }' is not assignable to type 'IntrinsicAttributes & CleanProps<"button", ButtonPropsWeControl> & OurProps<"button", ButtonRenderPropArg> & { ...; } & { ...; }'.
  Property 'disabled' does not exist on type 'IntrinsicAttributes & CleanProps<"button", ButtonPropsWeControl> & OurProps<"button", ButtonRenderPropArg> & { ...; } & { ...; }'.
@odeyal0
Copy link
Author

odeyal0 commented Mar 2, 2023

In addition, v1.7.12 has a problem with ref type.
Added to example. (v1.7.11 it's OK)

@RobinMalfait RobinMalfait self-assigned this Mar 2, 2023
@RobinMalfait
Copy link
Collaborator

Hey! Thank you for your bug report!
Much appreciated! 🙏

We recently improved some of our TypeScript types and made them reflect reality better. In this case disabled isn't a prop you can pass to the button. You can see this in your CodeSandbox link as well, the disabled prop is passed but it still works, aka it is not disabled.

If you want to disable the Listbox, then you have to move the disabled prop to the Listbox component itself.

The ref type issue will be fixed by #2329

@RobinMalfait
Copy link
Collaborator

This should be fixed by #2329, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants