Skip to content

Conversation

@AllanMichay
Copy link
Contributor

@AllanMichay AllanMichay commented Jan 5, 2026

Context

While working on the PR to have custom roles, the design is to have the description in the combo box elements and this created an issue.

Description

This PR changes the way we calculate combobox elements height, allowing it to take the space it needs

Fixes LAGO-XXX


Note

Enhances layout of BaseComboBoxVirtualizedList to better handle item/header spacing and end-of-list padding.

  • Adds calculateItemMarginBottom and applies per-item marginBottom (no margin for headers; group/end spacing via ITEM_GROUP_MARGIN_BOTTOM)
  • Increases container height to virtualizerTotalSize + ITEM_GROUP_MARGIN_BOTTOM to preserve bottom padding
  • Removes per-row fixed height style so items can size naturally
  • Keeps getItemHeight/marginTop logic to align virtualizer estimates with new spacing

Written by Cursor Bugbot for commit b910094. This will update automatically on new commits. Configure here.

@AllanMichay AllanMichay self-assigned this Jan 5, 2026
@AllanMichay AllanMichay added the 🥷 chore This doesn't seem right label Jan 5, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

}

return 0
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mismatch between estimated and actual bottom margins for items

The calculateItemMarginBottom function returns 0 for items followed by another item, but getItemHeight (used as estimateSize for the virtualizer) calculates a 4px bottom padding for the same scenario. This inconsistency causes the virtualizer's size estimates to be consistently larger than actual rendered sizes. For a list of consecutive items, estimates will be ~4px per middle item higher than actual, potentially causing visual jumpiness as items are measured and repositioned.

Additional Locations (1)

Fix in Cursor Fix in Web

className="relative w-full"
style={{
height: `${virtualizerTotalSize}px`,
height: `${virtualizerTotalSize + COMBOBOX_CONFIG.ITEM_GROUP_MARGIN_BOTTOM}px`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unconditional margin addition to container height causes extra space

The container height unconditionally adds ITEM_GROUP_MARGIN_BOTTOM (8px) to virtualizerTotalSize. However, when the last element is a header (which returns 0 from calculateItemMarginBottom), this adds unnecessary space. Additionally, since getItemHeight already includes bottom margin in its estimates for the last item, this creates double-counting when the virtualizer uses estimates. The result is inconsistent extra whitespace at the bottom of the list.

Fix in Cursor Fix in Web

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

Labels

🥷 chore This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants