downshift-js / downshift

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
http://downshift-js.com/
MIT License
12.11k stars 932 forks source link

`onSelectedItemChange` triggers multiple times when `onMouseMove` and `onClick` happens in the same frame #1597

Closed jeffijoe closed 4 months ago

jeffijoe commented 7 months ago

Relevant code or config

It's related to onSelectedItemChange

What you did: Use Playwright for testing a combobox.

What happened: The onSelectedItemChange is triggered twice.

Reproduction repository:

I based the reproduction on the official example for multi-selects.

https://github.com/jeffijoe/mobx-react-downshift-issue

Problem description: onSelectedItemChange triggers multiple times when onMouseMove and onClick happens in the same frame

Suggested solution: Prevent calling onSelectedItemChange twice in the same frame

silviuaavram commented 4 months ago

as long as this works for the end user, I would consider it closed. please reopen if you can repro as a normal user. thanks!

mikkogyntherfuturice commented 3 months ago

To me it seems the same issue happens on my project. It also happens only when e2e testing using Playwright and unfortunately multiplied events caused enough trouble to require a hack to ignore repeated events in a single rendering pass in the React app I'm working on. The application code isn't as clean as I'd prefer and things getting really bad is a sum of many parts but still it would be nice if the importance of Playwright and e2e testing was reconsidered.