Conditionally preventDefault