This commit addresses the issue where the overlay in components does not hide
when clicking outside the component, if the click event is stopped using
stopPropagation on an element or its parents.
The solution changes the event listener for detecting outside clicks to be
triggered in the capture phase instead of the bubbling phase.
This ensures that the outside click is correctly detected even if
stopPropagation is called.