feat(Select): add position prop & align-item#1954
Conversation
🦋 Changeset detectedLatest commit: e80a153 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
CleanShot.2026-02-19.at.14.55.28.mp4This is close, but it needs to account for the scroll buttons potentially being there. I would expect clicking on the trigger and then again quickly without moving my mouse it would hit the selected item and not the scroll button. I will give this a more thorough review when I have some time, as I see some things in the constructor etc that look like they are causing extra work even when the position is not item-aligned. Thank you! |
7e4bc25 to
5c7ec55
Compare
70d64d3 to
515b709
Compare
commit: |
Adds documentation, API reference, and demo scaffolding for the upcoming `position="item-aligned"` feature. Implementation removed — will be re-ported from Radix UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ports the exact SelectItemAlignedPosition algorithm from Radix UI's select.tsx. Uses a two-div structure (fixed wrapper + content) with direct DOM style writes, matching Radix's approach: - Aligns the selected item's center vertically with the trigger's center - Aligns the item's left edge with the trigger value node's left edge - Expands the content wrapper as the user scrolls (shouldExpandOnScroll) - Repositions once when scroll buttons appear (handleScrollButtonChange) - Closes the select on window resize (Radix behaviour) Also adds `getAllItemNodes()` to SelectBaseRootState to correctly detect first/last items (including disabled) for edge padding calculations. Combobox content types omit `position` since item-aligned doesn't apply when filtering by typing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ce4f44e to
2acd445
Compare
…s trailing scroll-down arrow In item-aligned mode, setHighlightedNode's scrollIntoView call was racing the positioner and shifting the selected item ~8px from the trigger. Skip that scroll when item-aligned is active. Additionally, when the last item is at the trigger position the algorithm leaves a tiny strip of scrollable space below it; suppress the scroll-down arrow when there is no next item to scroll to so the menu visually ends at the last item's bottom edge. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…elpers The dismissable layer attaches its document-level pointerdown listener via setTimeout(1) to skip the bootstrapping pointerdown event. Tests that open the menu and immediately click outside can race this delay, leaving the listener unattached when the click fires. Add a vi.waitFor on globalThis.bitsDismissableLayers in the open helpers so subsequent outside clicks reliably hit the dismiss handler. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Bits doesn't lock page scroll when the portal is open the way Radix does, which raises the question of how to handle the portal size when scrolling |
49ec078 to
70c70ea
Compare
70c70ea to
49ec078
Compare
No description provided.