-
Notifications
You must be signed in to change notification settings - Fork 935
fix(SelectMenu): correct virtualization height estimation when using item-description slot #5363
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
base: v4
Are you sure you want to change the base?
fix(SelectMenu): correct virtualization height estimation when using item-description slot #5363
Conversation
β¦on slot - Fix virtualizerProps to check for both description data and item-description slot - Ensures correct item height estimation when using slots with virtualization - Prevents UI issues like overlapping items or broken scrolling
commit: |
benjamincanac
left a comment
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.
Didn't think of that, nice catch! We probably have the issue in InputMenu and CommandPalette as well.
Maybe it would be easier to fix it using a function on estimateSize because not all items necessarily have a description π¬
|
Thanks for the suggestion! I explored implementing per-item The Challenge:
Here's the relevant code in reka-ui: // In reka-ui/ListboxVirtualizer.vue line 67
estimateSize() {
return props.estimateSize ?? 28 // Always returns a static number
} |
benjamincanac
left a comment
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.
This change is also needed in CommandPalette and InputMenu I guess.
π Linked issue
This PR fixes a virtualization bug when using
item-descriptionslot with SelectMenu. No existing issue was filed as the bug was discovered and fixed directly.β Type of change
π Description
Problem:
When using the
item-descriptionslot withvirtualizeenabled in SelectMenu, items overlap and scrolling breaks due to incorrect height estimation.Visual Evidence:
Before (Broken):

Items overlap because virtualizer estimates 32px height but actual rendered height is 52px with descriptions
After (Fixed):

Items render correctly with proper 52px spacing when descriptions are present
Reproduction:
Root Cause:
The original
virtualizerPropsused a fixedestimateSizeof 24-40px (based on size) for all items, regardless of whether they had descriptions:However, the template renders descriptions when either data exists OR the slot is used:
This mismatch caused the virtualizer to estimate 32px heights even when descriptions were being rendered (requiring 52px), resulting in overlapping items and broken scrolling.
Solution:
The fix detects whether any item will have a description rendered (either from data OR from the slot) and adjusts the
estimateSizeaccordingly (look at code diff)π Checklist