Stop event propagation when hiding or removing an element so that it doesnt look weird