Skip to content

Commit

Permalink
Fix repeating keys in Firefox and Opera by using keypress instead of …
Browse files Browse the repository at this point in the history
…keydown for them.
  • Loading branch information
Anders committed Jun 24, 2009
1 parent 1994abe commit 78c51ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jquery.timePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@
$tpDiv.hide();
}
});
// Key support
$(elm).keydown(function(e) {
// Keypress doesn't repeat on Safari for non-text keys.
// Keydown doesn't repeat on Firefox and Opera on Mac.
// Using kepress for Opera and Firefox and keydown for the rest seems to
// work with up/down/enter/esc.
var event = ($.browser.opera || $.browser.mozilla) ? 'keypress' : 'keydown';
$(elm)[event](function(e) {
var $selected;
keyDown = true;
var top = $tpDiv[0].scrollTop;
Expand Down

0 comments on commit 78c51ee

Please sign in to comment.