studiobakers / react-ui-toolkit

Bakers Studio's React-based UI Toolkit
MIT License
15 stars 2 forks source link

TypeaheadSelect: onClickOutside is not working correctly when there is more than one select component #195

Open gulcinuras opened 2 years ago

gulcinuras commented 2 years ago

https://user-images.githubusercontent.com/79009325/162752870-84fe3fda-57a3-468c-9dd1-67c64ecedc82.mov

jamcry commented 5 months ago

Hello after 2 years 😄 I recently had a similar issue. In my case the problem was that I was using event.stopPropagation() on the parent element of the dropdown menu. Since event.stopPropagation() prevents emitting the click event, useOnClickOutside() was not being triggered.

If we are using stopPropagation or similar function in typeahead select, it can be the reason. The similar issue exists in the lists with dropdown menus. I highly suspect that this is related to event.stopPropagation in the list items there.

Screenshot 2024-05-29 at 20 12 06