Skip to content

fix select not allowing direct selection of last item in scrollable menu#8023

Open
knQzx wants to merge 5 commits intopalantir:developfrom
knQzx:fix-select-last-item
Open

fix select not allowing direct selection of last item in scrollable menu#8023
knQzx wants to merge 5 commits intopalantir:developfrom
knQzx:fix-select-last-item

Conversation

@knQzx
Copy link
Copy Markdown

@knQzx knQzx commented Apr 5, 2026

summary

  • fix select component not allowing direct selection of last item in scrollable menu
  • the scrollActiveItemIntoView method in QueryList was over-scrolling by one item height in both directions - when scrolling down it added activeHeight twice to compute the new scrollTop, and when scrolling up it subtracted an extra activeHeight. 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.
  • also fix toast with Infinity timeout being dismissed early by guarding with Number.isFinite

test plan

  • added tests for scroll-to-bottom and scroll-to-top alignment in queryList.test.tsx
  • verified existing select and query-list tests still pass

fixes #6655

knQzx added 2 commits April 5, 2026 11:10
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.
Copilot AI review requested due to automatic review settings April 5, 2026 09:12
@changelog-app
Copy link
Copy Markdown

changelog-app bot commented Apr 5, 2026

Generate changelog in packages/core/changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

fix select not allowing direct selection of last item in scrollable menu


Generate changelog in packages/select/changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

fix select not allowing direct selection of last item in scrollable menu


Check the box to generate changelog(s)

  • Generate changelog entry

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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” for Toast, 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select does not allow direct selection of last item in scrollable menu

2 participants