Skip to content

Commit f92fa89

Browse files
committed
Added customized keys
1 parent 6732f2b commit f92fa89

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

spatial_navigation.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,14 @@
3232
restrict: 'self-first', // 'self-first', 'self-only', 'none'
3333
tabIndexIgnoreList:
3434
'a, input, select, textarea, button, iframe, [contentEditable=true]',
35-
navigableFilter: null
36-
};
37-
38-
/*********************/
39-
/* Constant Variable */
40-
/*********************/
41-
var KEYMAPPING = {
42-
'37': 'left',
43-
'38': 'up',
44-
'39': 'right',
45-
'40': 'down'
35+
navigableFilter: null,
36+
directionKeys: {
37+
'37': 'left',
38+
'38': 'up',
39+
'39': 'right',
40+
'40': 'down'
41+
},
42+
enterKey: 13
4643
};
4744

4845
var REVERSE = {
@@ -853,9 +850,9 @@
853850
return false;
854851
};
855852

856-
var direction = KEYMAPPING[evt.keyCode];
853+
var direction = GlobalConfig.directionKeys[evt.keyCode];
857854
if (!direction) {
858-
if (evt.keyCode == 13) {
855+
if (evt.keyCode == GlobalConfig.enterKey) {
859856
currentFocusedElement = getCurrentFocusedElement();
860857
if (currentFocusedElement && getSectionId(currentFocusedElement)) {
861858
if (!fireEvent(currentFocusedElement, 'enter-down')) {
@@ -900,7 +897,7 @@
900897
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) {
901898
return
902899
}
903-
if (!_pause && _sectionCount && evt.keyCode == 13) {
900+
if (!_pause && _sectionCount && evt.keyCode == GlobalConfig.enterKey) {
904901
var currentFocusedElement = getCurrentFocusedElement();
905902
if (currentFocusedElement && getSectionId(currentFocusedElement)) {
906903
if (!fireEvent(currentFocusedElement, 'enter-up')) {

0 commit comments

Comments
 (0)