Fix tab not toggling the compose window in Firefox.

(imported from commit 4dfd3d6eb3e81c519d0aefbfe0b3b1390adb241b)
This commit is contained in:
Tim Abbott 2012-10-15 10:45:31 -04:00
parent db3c40fad1
commit 4062550ef7
1 changed files with 10 additions and 5 deletions

View File

@ -170,10 +170,15 @@ $(document).keydown(function (event) {
$(document).keypress(function (event) {
// What exactly triggers .keypress may vary by browser.
// Welcome to compatability hell.
var result = keydown_handler(event.which);
if (typeof result === 'function') {
keydown_handler = result;
event.preventDefault();
//
// In particular, when you press tab in Firefox, it fires a
// keypress event with keycode 0 after processing the original
// event.
if (event.which !== 0 && event.charCode !== 0) {
var result = keydown_handler(event.which);
if (typeof result === 'function') {
keydown_handler = result;
event.preventDefault();
}
}
});