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

fix: add max height to SelectContent when position is popper #5713

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Tofugrass
Copy link

I added max-h-[var(--radix-select-content-available-height)] to SelectContent className when position is popper according to https://www.radix-ui.com/primitives/docs/components/select#constrain-the-content-size.

Without this, Select's with many items have a height greater than the screen and can't be scrolled. Tested on chrome (mobile and desktop). Tested with small lists and lists that overflow the screen. I suspect people are fixing this issue in the wild by changing position to 'item-aligned'. Radix also recommends setting the width of the SelectContent to var(--radix-select-trigger-width); but I haven't personally had a need for this.

Without max height:
without_max_h

With max height:
with_max_h

…ctContent when position is popper.

Without this, selects with many items render off screen and can't be scrolled.
Copy link

vercel bot commented Nov 4, 2024

@Tofugrass is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

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 this pull request may close these issues.

1 participant