Skip to content

[19600] fix: Scroll behavior on hover and open, fix partialSelected with groups - #19601

Open
fkwq34 wants to merge 1 commit into
primefaces:masterfrom
fkwq34:fix/multiselect-select
Open

[19600] fix: Scroll behavior on hover and open, fix partialSelected with groups#19601
fkwq34 wants to merge 1 commit into
primefaces:masterfrom
fkwq34:fix/multiselect-select

Conversation

@fkwq34

@fkwq34 fkwq34 commented May 27, 2026

Copy link
Copy Markdown

fixes: #19600

Description

This PR fixes several issues in Select and MultiSelect components related to scroll behavior and partial selection state.

Issues Fixed

1. Hover causes unwanted scroll jumping

When hovering over options in Select/MultiSelect dropdowns with virtual scroll, the list would unexpectedly jump/scroll.

Root cause: onOptionMouseEnter was calling changeFocusedOptionIndex(), which triggers scrollInView().

Fix: Changed onOptionMouseEnter to directly set focusedOptionIndex for visual styling without triggering scroll.

2. Dropdown not scrolling to selected item on open

When reopening a Select/MultiSelect with virtual scroll, it would sometimes show the wrong position or not scroll to the selected item.

Root cause: Was using focusedOptionIndex() (which could be changed by hover) instead of the actual selected item index.

Fix: Use findSelectedOptionIndex() when determining scroll position on overlay open, with proper timing for virtual scroller initialization.

3. MultiSelect partialSelected() broken with grouped options

When using grouped options with a custom header checkbox template, the indeterminate state would disappear after selecting items.

Root cause: partialSelected() compared selectedOptions.length with options.length, but options includes group objects when using groups.

Fix: Changed partialSelected() to use hasSelectedOption() && !allSelected() which properly handles groups.

Steps to Reproduce

Issue 1 & 2:

  1. Create a Select/MultiSelect with [virtualScroll]="true" and many options
  2. Select an item lower in the list
  3. Close and reopen the dropdown
  4. Observe scroll position and try hovering near the top

Issue 3:

  1. Create a MultiSelect with [group]="true" and custom headerCheckboxIconTemplate
  2. Select multiple items
  3. Observe the header checkbox indeterminate state

Expected Behavior

  • Hovering over options should only update visual focus styling, not cause scrolling
  • Opening dropdown should scroll to show the selected item immediately
  • partialSelected() should return true when some (but not all) selectable items are selected, regardless of grouping

Files Changed

  • packages/primeng/src/select/select.ts
  • packages/primeng/src/multiselect/multiselect.ts

@fkwq34 fkwq34 changed the title fix(select, multiselect): Fix scroll behavior on hover and open, fix partialSelected with groups [19600] fix: Scroll behavior on hover and open, fix partialSelected with groups Jun 23, 2026
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 / Multiselect jumping on hover; Multiselect header checkbox status

1 participant