diff --git a/package.json b/package.json index 81a6e86..35fe032 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "spatial-navigation-js", "description": "A javascript-based implementation of Spatial Navigation.", - "version": "1.1.1", + "version": "1.1.2", "main": "spatial_navigation.js", "homepage": "https://github.com/mirego/js-spatial-navigation#readme", "repository": { diff --git a/spatial_navigation.js b/spatial_navigation.js index 2d17290..29c01e8 100644 --- a/spatial_navigation.js +++ b/spatial_navigation.js @@ -19,7 +19,9 @@ '40': 'down' }; - var DEFAULT_SELECT_KEY_CODES = [13]; + var ENTER_KEY_CODE = 13; + + var DEFAULT_SELECT_KEY_CODES = [ENTER_KEY_CODE]; /************************/ /* Global Configuration */ @@ -863,8 +865,10 @@ if (!fireEvent(currentFocusedElement, 'enter-down')) { return preventDefault(); } - preventDefault(); - currentFocusedElement.click(); + if (evt.keyCode !== ENTER_KEY_CODE) { + preventDefault(); + currentFocusedElement.click(); + } } } return;