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

Combobox with virtual scrolling not showing up #3191

Closed
kenn opened this issue May 9, 2024 · 2 comments
Closed

Combobox with virtual scrolling not showing up #3191

kenn opened this issue May 9, 2024 · 2 comments
Assignees

Comments

@kenn
Copy link

kenn commented May 9, 2024

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

For example: v2.0.3

What browser are you using?

Chrome, Brave, Safari, all latest versions

Reproduction URL

https://codesandbox.io/p/devbox/vigorous-chebyshev-3cf9cg

Describe your issue

Given the minimal code example, the combobox won't open when there's virtual={{ options: filteredPeople }} on Combobox and using render props under ComboboxOptions.

The code above is just taken from the blog post.


Screenshot 2024-05-09 at 18 26 04

@intsuc
Copy link

intsuc commented May 13, 2024

If you increase the height of ComboboxOptions to greater than 0, the options should display correctly. The code in the blog post internally does this with p-1.

@RobinMalfait
Copy link
Collaborator

Hey!

The example code snippets doesn't provide any styles so you would need to add some styles to make it look pretty. One side effect right now of using virtual mode is that it needs to compute the height of the container and each item to know how many items can be shown. This is also needed to calculate the scrollbar height and position.

If you add some styles such as a padding like @intsuc mentioned then there is some height and the necessary calculations can start.

We will try to improve this, but since you need to add styles anyway I think this is a good workaround for now.

Hope this helps!

@RobinMalfait RobinMalfait self-assigned this May 30, 2024
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

No branches or pull requests

3 participants