diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 214b1469..57352b71 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -454,10 +454,30 @@ requires $(function() { // fixme: how to do this better? - if ($.browser.safari) { - $document.keydown(keypress); - } else { + // in firefox, keypress doesn't fire for up/down + // if the cursor is at the start/end of an input element + if ($.browser.mozilla) { $document.keypress(keypress); + $document.keydown(function(event) { + var $element = $("input:focus"); + if ($element.length) { + console.log("@", $element[0].selectionStart, $element[0].selectionEnd) + if ( + ( + keyNames[event.keyCode] == "up" && + $element[0].selectionStart + $element[0].selectionEnd == 0 + ) || ( + keyNames[event.keyCode] == "down" && + $element[0].selectionStart == $element.val().length && + $element[0].selectionEnd == $element.val().length + ) + ) { + keypress(event); + } + } + }); + } else { + $document.keydown(keypress); } }); function keypress(event) {