Multiselect scroll position reset bug
Describe the bug
After selecting an item on Multiselect that has long item list, the scroll position keeps reset to the selected item position. This is even reproducible in the latest tutorial https://primereact.org/multiselect/
Reproducer
No response
PrimeReact version
10.6.2
React version
17.x
Language
ES6
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
Can confirm this is happening in version 10.6.2 of PrimeReact, but does not happen in 10.5.1.
It just constantly scrolls back up to the top of the list.
Working (10.5.1)
Not Working (10.5.2 through 10.6.2)
It looks like the bug was introduced in 10.5.2
@melloware there's a half dozen issues related to this one, I think they relate to the changes/enhancements you made recently
https://github.com/primefaces/primereact/commit/736a9daa8cf1a706cb07d949e078b5cdca4910f2
for now it breaks scrolling and arrow selection
changeFocusedOptionIndex called scrollIntoView but scrollIntoView using data-p-highlight as selector
maybe we need a data-p-focus to differentiate
If I understand correctly, the scrollInView should only be executed when the panel is opened.
the changeFocusedOptionIndex should be executed when hover or arrow down and up
@kl-nevermore that is correct scrollInView only when panel is open and changedFocusedOptionIndex when panel is open and hover or keyboard.
PR submitted. Basically on Panel open it should focus the first selected option. On Hover or keyboard it should focus the current Target.