Here I have 3 dropdowns.
When click outside all of 3 dropdowns are closed normally but when I click on the other dropdown the others remain opened when already opened.
The intended behavior is that even when I click on other dropdown it should close whatever dropdown already opened.
How to achieve this?
This is a the demo I’m working on:
https://stackblitz.com/edit/github-mxncy7?file=src%2Findex.css
2
Answers
Use
onBlur
event to close the dropdown:Full demo on Stackblitz.
Its because its set to handle clicks outside that is the background and the drop down list is a button.