-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[Bug]: Command/Combobox TypeError and Unclickable/Disabled items, cmdk breaking change #2944
Comments
Some notes, seems like Edit: Without a |
I'm face same issue |
+1 |
Figured out the issue, in cmdk changenotes: It seems that the data-disabled prop is also set to false whereas before the property would not exist at all until being disabled, and The fix is to replace |
I encountered a similar problem when using the Combobox, but in my situation, the issue wasn't that it was unclickable or "disabled"; rather, the application would crash whenever the Combobox was opened. This is what I ran into for anyone googling this error:
This is also solved by pinning cmdk version to 0.2.1 in package.json for now. Thanks @jhnguyen521 |
Hey, I forgot to put in the error, but this is likely because you don't have a
Some of the examples for the Command component are incorrect (which I also copy-pastaed (: ) and don't use a tl;dr Try just putting a |
This is totally the issue, adding the Any thought on if we should be wrapping Updating the examples will resolve the crash issue for future users, but the "aria-disabled" breaking change will still need to be updated so anyone with this issue should keep 0.2.1 pinned in their package.json until #2945 is merged by changing
to
Thanks again @jhnguyen521! |
I also had to remove const CommandItem = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
>(({ className, ...props }, ref) => (
<CommandPrimitive.Item
ref={ref}
className={cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className,
)}
{...props}
/>
)) Which makes me then wonder, what was it doing in the first place :) |
I believe it should be above
I don't think so, the Command component doesn't do any special handling around Edit: nvm, it has attributes for the aria-x. It's just styling, so it doesn't really matter, but I can just update this in my PR |
Ignore this, I missed the post about changing to I''ve also moved the position of |
like @shainegordon said, I had to adjust the styles to fix this
note the change |
@matowang <CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Features">
{featureItems.map((item) => (
<CommandItem
key={item.url}
onSelect={() =>
router.push(
item.url.replaceAll(
"$username",
user.username
)
)
}
>
<IconArrowRight className="mr-2 h-4 w-4" />
<span>{item.title}</span>
</CommandItem>
))}
etc etc Taking into account the |
This should be addressed with PR #2945 🤞 |
This reverts commit bcfbf30. Due to shadcn issue: shadcn-ui/ui#2944
I had the same issue when updating to
Thank you! 🙏🏻 |
the scrollbar doesn't work |
This is very interesting, because in tailwind, you cannot add multiple classes to different states, like hover/active/focus/disabled |
Nothing is working for me: scroll, field focus, items mouse over. It is just static and I've applied all workaround suggested in here. I'm using react 18 and nextjs 14.2.4 |
I'm on the same boat as @paulofabiano May I know what else need to be done beside downgrading |
It should be working by downgrading
|
This works well for me. |
Works perfectly. Thank you! |
Been hearing about Shadcn for a while, finally trying it out and one of the first components I try is buggy. Surprised this is still not fixed as of August. Thanks for the fix, though! |
saved me a lot of time. Thanks! |
Seems like an issue still |
I was playing around with the first example Combobox from the docs and even after applying the fixes it still breaks. |
Tried going back to 0.2.0, still didn't work for me. Looks like I chose the wrong library |
It’s an extremely simple fix, just do this - #2944 (comment) Rather don’t throw the baby out with the bath water, for a lot of use cases, this is actually an excellent “library” agreed that it’s a bit annoying that this issue is closed, but apparently this isn’t resolved |
Still broken. I tried everything in this thread: Removing Pinning Using Now remembering that this is what caused me to drop shadcn on a previous project -- combobox is a nightmare. It's generally worked for me for everything else, so i'm not ready to abandon it yet. But I totally empathize with people who try out shadcn, can't get the boilerplate combobox to work, and abandon the library. |
Go into your const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
<CommandList>{children}</CommandList>
</Command>
</DialogContent>
</Dialog>
)
} |
anybody got lucky with this issue? I'm well aware of the here's a sample usage:
A bit strange to see that the issue is still there despite the particular |
Any chance some of this behavior has resurfaced recently? These comboboxes were working fine for me a 1-2 weeks ago and now I can't select any of the options, despite not making any related code changes or library upgrades. My command component already has the |
Still not sure what broke this for me, but I found a fix by adding the
|
if you have |
I managed to resolve the issue by removing the <PopoverPrimitive.Portal> inside popover.tsx |
This fixed it for me! Thanks |
This resolved it for me: But the issue I'm seeing now is the |
Describe the bug
When utilizing a Command component that has been added/updated as of 03/07/2024 ~6PM PST, items cannot be clicked and are disabled. (Additionally some examples using command in the docs are incorrect)
Additionally,
<CommandItem>
s that are not surrounded by a<CommandList>
will crash the application and upon opening the Command component, the error:TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
will be thrown.This is due to cmdk making a new release with breaking changes: https://github.com/pacocoursey/cmdk/releases
Workaround
This can be fixed by pinning cmdk version to 0.2.1 in package.json
See #2944 (comment)
Solution
#2944 (comment) for disabled items fix
#2944 (comment)
for error fix
Please see PR #2945 to fix these issues
Affected component/components
Command
How to reproduce
npx shadcn-ui@latest add command
after 03/07/2024Codesandbox/StackBlitz link
https://codesandbox.io/p/devbox/shadcn-playground-forked-4xxqcw?workspaceId=2d1a1544-9936-4d36-a113-0092357e5e51
Logs
No response
System Info
Before submitting
The text was updated successfully, but these errors were encountered: