Correct click-outside handling