Seems like a bug in Firefox where alert breaks the synchronicity of your code. Delaying the alert seems to workaround the issue:
$(document).bind('keydown', 'Ctrl+s', function(event) {
setTimeout(function() {
alert('saving?');
}, 0);
return false;
});
JSbin
Here's a test case to prove my bug claim.
$(document).bind('keydown', 'Ctrl+s', function(event) {
event.preventDefault();
});
The above (bin) will prevent the save dialog nicely. Now if you add an alert either before or after it, the save dialog will appear nevertheless if you do event.preventDefault() and event.stopImmediatePropagation() or return false:
$(document).bind('keydown', 'Ctrl+s', function(event) {
event.preventDefault();
event.stopImmediatePropagation();
alert('saving?');
return false;
});
Bin
event.preventDefault() on its own is enough to prevent the save dialog if there are no alerts, now with an alert it is possible to prevent the default action.