You made my day already in less than 5 minutes, I've been trying this for more than a day, I had to learn event propagation, bubbling and capturing😢, But thanks dude ❤
Why did you add ref to the menu-container. I suppose when we click next to your profile icon, the drop-down doesn't close right? Correct me if I am wrong.
Very easy to understand with the extra animations and illustrations! You even explained everything in details (whilst not overtalking about it) which made it even better! Millions thanks to your great work!
And how to achieve if you have a list of 2, galena and galeno. You filter by galena... now you have 1. And when you erase the last word to get a list of 2 again. Like going back to the original.
Hey, thanks! I have not had time to look at the code but I am looking for a a piece of code to add to a shadcn/ui button and I think you vid/code is just the ticket. Once again, many thanks!
you can write something like this: "const dropdown = document.querySelector('.dropdown'); document.addEventListener('click', function (e) { if (e.target !== dropdown) { dropdown.classList.remove('open'); } }); "