-
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
Dropdown Menu doesn't allow scrolling #149
Comments
Can I help you |
did you got any solution on this :( this is soo problematic |
This is because of accessibility. If you want to keep the content outside of the dropdown interactive you can use |
Try wrapping https://ui.shadcn.com/docs/components/scroll-area |
I tried it, It's not helping |
Does anyone have a better solution? |
Just add |
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. |
Found out just have height defined and overflow scroll class added worked for me, like this : |
The cause is the So I add a prop called
When you're like me putting the DropdownMenu in Dialog for example, you can add this prop:
Then it can scroll now. I tried with the modal={false} also, but it doesn't work and I still cannot scroll when I put the |
Works, thanks |
Shadcn should add the following properties to DropdownMenuContent
It would like this: const DropdownMenuContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & { container?: HTMLElement | null }
>(({ className, sideOffset = 4, container, ...props }, ref) => (
<DropdownMenuPrimitive.Portal container={container}>
<DropdownMenuPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
'z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className,
)}
{...props}
/>
</DropdownMenuPrimitive.Portal>
));
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; With these properties, scrolling would be possible and the drop-down menu would take up the entire height available Can someone open a PR for this? |
Fixes shadcn-ui#149 Add scrolling capability to `DropdownMenuContent` component. * Modify `apps/v4/registry/new-york-v4/ui/dropdown-menu.tsx` to include `max-h-[var(--radix-dropdown-menu-content-available-height)]` and `overflow-y-auto` properties in `DropdownMenuContent` className. * Update `apps/www/registry/default/ui/dropdown-menu.tsx` to add `max-h-[var(--radix-dropdown-menu-content-available-height)]` and `overflow-y-auto` properties in `DropdownMenuContent` className. * Change `apps/www/registry/new-york/ui/dropdown-menu.tsx` to include `max-h-[var(--radix-dropdown-menu-content-available-height)]` and `overflow-y-auto` properties in `DropdownMenuContent` className. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/shadcn-ui/ui/issues/149?shareId=XXXX-XXXX-XXXX-XXXX).
I have created a PR myself. Also for the other components that open in a modal. Would be great if you could all support them 🙂 |
Is there a particular reason why
Dropdown Menu
does not allow scrolling, whileMenubar
does?The text was updated successfully, but these errors were encountered: