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

Scrollbar not visible in Select dropdown on content overflow (visible if options > 10) #47399

Closed
prajwalkulkarni opened this issue Feb 7, 2024 · 4 comments

Comments

@prajwalkulkarni
Copy link

Reproduction link

https://stackblitz.com/edit/react-mnyapj?file=demo.tsx

Steps to reproduce

  1. Use <Select> component with <=10 options.
  2. To see the last option, we will have to scroll, although it is scrollable, the scrollbar is not visible.
  3. Or, Implement a custom list item, if the height of each list item is large enough, say 50px, overflow occurs on 4-5 options, but the scrollbar is not visible until there are more than 10 options.

What is expected?

Scrollbar should be visible on overflow, regardless of the number of options available.

What is actually happening?

Scrollbar is not visible unless there are more than 10 options.

Environment Info
antd 4.24.9
React 17.x
System Windows 11
Browser Chrome version 121.0.6167.140

For custom list item implementation, it looks like the issue is due to not passing the optional listItemHeight, as the default values are passed and rc-virtual-list is determining whether or not to show the scrollbar with one of the conditions being itemHeight * data.length > height (https://github.com/react-component/virtual-list/blob/master/src/List.tsx)
The prop listItemHeight can be made mandatory when a custom list item is implemented, i.e., children is passed.
Regarding, the regular select option, I think the above condition is returning false (itemHeight * data.length > height) default values of itemHeight being 20 and height being 200.

Copy link

stackblitz bot commented Feb 7, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@afc163
Copy link
Member

afc163 commented Feb 8, 2024

Fixed in #47050

@afc163 afc163 closed this as completed Feb 8, 2024
@prajwalkulkarni
Copy link
Author

That still wouldn't work on custom list item, right?

@afc163
Copy link
Member

afc163 commented Feb 9, 2024

It is not released yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants