Use WebKit-friendly `keydown` instead of `keypress`, only trigger the click event when the cancel button is visible.