Made the preventDefault only apply if the target is window