Looks like a bug in Firefox, where alert disrupts the synchronization of your code. Delaying the warning seems to get around the problem:
$(document).bind('keydown', 'Ctrl+s', function(event) { setTimeout(function() { alert('saving?'); }, 0); return false; });
Jsbin
Here is a test case confirming my mistake.
$(document).bind('keydown', 'Ctrl+s', function(event) { event.preventDefault(); });
The above ( bin ) will allow you to successfully save the save dialog. Now, if you add a warning before or after it, the save dialog will be , however, if you execute 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() alone is enough to prevent the save dialog, if there is no alert s, now with a warning you can prevent the default action.
Fabrício matté
source share