summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-03-08 14:23:29 +0200
committerAlon Levy <alon@pobox.com>2015-03-08 14:23:29 +0200
commitfc2aa0d574f70897280e26a53d8fb36eed78d715 (patch)
treecb2fc7037073f23a53af706619d4ef12857414cc /src
parent5adfc7654fb49e116e21bc8e8202d4a148be3780 (diff)
client/view/completer: use VK_*
Diffstat (limited to 'src')
-rw-r--r--src/client/consts.js4
-rw-r--r--src/client/view/completer.js9
2 files changed, 8 insertions, 5 deletions
diff --git a/src/client/consts.js b/src/client/consts.js
index 411a79e6..1c426695 100644
--- a/src/client/consts.js
+++ b/src/client/consts.js
@@ -19,9 +19,11 @@ define(function() {
description: description,
NEW_NODE_NAME: 'new node',
- // Keycodes (should just use jquery)
+ // Virtual Keycodes i.e. event.keyCode / event.key
+ // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keys-keyvalues
VK_UP: 38,
VK_DOWN: 40,
VK_ESCAPE: 27,
+ VK_TAB: 9,
};
});
diff --git a/src/client/view/completer.js b/src/client/view/completer.js
index f05c40a0..f113b556 100644
--- a/src/client/view/completer.js
+++ b/src/client/view/completer.js
@@ -8,7 +8,8 @@ var value = util.value,
// constants
var VK_UP = consts.VK_UP,
VK_DOWN = consts.VK_DOWN,
- VK_ESCAPE = consts.VK_ESCAPE;
+ VK_ESCAPE = consts.VK_ESCAPE,
+ VK_TAB = consts.VK_TAB;
function quoted__double(string) { // quote string using double quotes
return '"' + string + '"';
@@ -96,10 +97,10 @@ var completer = (function (input_element, dropdown, base_config) {
});
input_element.keydown(function(e) {
switch (e.keyCode) {
- case 38:
- case 40:
+ case VK_UP:
+ case VK_DOWN:
return false;
- case 9: // Tab
+ case VK_TAB: // Tab
if (config.hideOnTab) {
hide();
}