-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix long list output in Dropdown #535
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -12,6 +12,7 @@ export const Dropdown = (props: DropdownMenu.DropdownMenuProps) => ( | |||
const DropdownMenuItem = styled(GenericMenuItem)` | |||
position: relative; | |||
display: flex; | |||
min-height: 32px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding min-height here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vineethasok I found that just adding overflow-y: auto
on the parent container was not enough to maintain the expected height of the Dropdown.Item
elements.
I think it might be because there is a max expected height of the parent container and the height of this child component is calculated based on that; the more children, the less their height to fit inside the parent
@@ -93,6 +94,7 @@ const DropdownMenuContent = styled(GenericMenuPanel)` | |||
min-width: ${({ theme }) => theme.click.genericMenu.item.size.minWidth}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natalyjazzviolin Maybe we can also add maxHeight as a prop which can be provided by the user
@gjones Would love your thoughts
|
a5d9410
to
ce031b2
Compare
![]() |
@@ -93,6 +94,10 @@ const DropdownMenuContent = styled(GenericMenuPanel)` | |||
min-width: ${({ theme }) => theme.click.genericMenu.item.size.minWidth}; | |||
flex-direction: column; | |||
z-index: 1; | |||
overflow-y: scroll; | |||
max-height: calc( | |||
(var(--radix-${({ $type }) => $type}-content-available-height) - 100px) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, what does 100px
represent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoorayimhelping this subtracts 100px from the available height so the bottom of the dropdown doesn't get too close to the bottom of the screen per Daniel's request
Closes #533
Why
Currently lists over 15+ items in the Dropdown component do not display correctly:

What
This adds
overflow-y: auto
to theDropdown.Content
component to allow for scrolling and setsmin-height: 32px
on theDropdown.Item
to make sure it does not get compressed to less than the expected height. I got the32px
from the computed height of otherDropdown.Items
I looked at.Screen.Recording.2025-01-29.at.4.54.24.PM.mov