primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.2k stars 4.55k forks source link

Auto Scroll when clicking a group section #16376

Open dfernandez-elastic opened 6 days ago

dfernandez-elastic commented 6 days ago

Describe the bug

MultiSelect is auto scrolling to selected option when clicking a group option element.

Demo:

https://github.com/user-attachments/assets/003cf15e-08c3-409a-84c2-6c9c4983a4e6

Environment

-

Reproducer

No response

Angular version

18.1.1

PrimeNG version

17.18.9

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.15.1

Browser(s)

Chrome 127.0.6533.120

Steps to reproduce the behavior

  1. Go to https://primeng.org/multiselect#group
  2. Open "Select Cities" dropdown
  3. Select "Berlin"
  4. Click on "Japan" group
  5. Dropdown scrolls to "Berlin"

Expected behavior

Dropdown should not scroll

dfernandez-elastic commented 6 days ago

I checked your code base, and when we click the .p-multiselect-item-group element, the event bubbles until the onContainerClick method. In that method, we are triggering a focus.

Is there any reason why we are doing that? Can we disable it for group option clicks?