fix select not allowing direct selection of last item in scrollable menu#8023
fix select not allowing direct selection of last item in scrollable menu#8023knQzx wants to merge 5 commits intopalantir:developfrom
Conversation
the scrollActiveItemIntoView method was over-scrolling by one item height in both directions - when scrolling down it added activeHeight twice, and when scrolling up it subtracted an extra activeHeight. this caused the menu to shift under the cursor during click interactions on boundary items, preventing the click from registering on the intended item.
Generate changelog in
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes scroll alignment logic in QueryList so boundary items (e.g., last visible item) can be directly clicked without the menu shifting under the cursor; also hardens Toast timeout handling for Infinity.
Changes:
- Correct
QueryList.scrollActiveItemIntoView()scrollTop calculations to avoid over-scrolling by one item height. - Add unit tests verifying top/bottom alignment behavior when scrolling active items into view.
- Treat
timeout={Infinity}as “no timeout” forToast, with docs + test coverage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/select/src/components/query-list/queryList.tsx | Fixes offscreen top/bottom scroll alignment to prevent over-scrolling. |
| packages/select/src/components/query-list/queryList.test.tsx | Adds regression tests for top/bottom scroll alignment cases. |
| packages/core/src/components/toast/toastProps.ts | Documents Infinity as disabling the toast timeout. |
| packages/core/src/components/toast/toast.tsx | Disables timeout when timeout is not finite (e.g., Infinity). |
| packages/core/src/components/toast/toast.test.tsx | Adds test to ensure timeout={Infinity} does not dismiss. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
summary
scrollActiveItemIntoViewmethod inQueryListwas over-scrolling by one item height in both directions - when scrolling down it addedactiveHeighttwice to compute the newscrollTop, and when scrolling up it subtracted an extraactiveHeight. this caused the menu to shift under the cursor during click interactions on boundary items (first/last visible), preventing the click from registering on the intended item.Infinitytimeout being dismissed early by guarding withNumber.isFinitetest plan
queryList.test.tsxfixes #6655