ui: Dropdown Menu doesn't allow scrolling
Is there a particular reason why Dropdown Menu does not allow scrolling, while Menubar does?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 18 (2 by maintainers)
Commits related to this issue
- docs: Appearance Form Label Fix (#149) — committed to u007/ui by pratik227 3 years ago
- Fix Dropdown Menu scroll issue Fixes #149 Add scrolling capability to `DropdownMenuContent` component. * Modify `apps/v4/registry/new-york-v4/ui/dropdown-menu.tsx` to include `max-h-[var(--radix-dr... — committed to paralin/ui by paralin 2 years ago
This works:
This is because of accessibility. If you want to keep the content outside of the dropdown interactive you can use
modal={false}inDropdownMenu.RootJust add
<DropdownMenu modal={false}>and It’ll work.Try wrapping https://ui.shadcn.com/docs/components/scroll-area It helped me
Found out just have height defined and overflow scroll class added worked for me, like this : <DropdownMenuContent align=“end” className=“bg-white overflow-y-scroll h-96”
The cause is the
<DropdownMenuPrimitive.Portal>in my case, when I put theDropdownMenuinDialog(DialogContent) and I can’t scroll inside theDropdownMenuContent(only possible by dragging the ScrollArea’s ScrollBar with the mouse).So I add a prop called
isInsideDialog: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
DropdownMenuinDialogContent, that’s why I had to remove the use of<DropdownMenuPrimitive.Portal>.Can I help you
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.
Shadcn should add the following properties to DropdownMenuContent
max-h-[var(--radix-dropdown-menu-content-available-height)]overflow-y-autoIt would like this:
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?
did you got any solution on this 😦 this is soo problematic