diff --git a/sphinx/themes/basic/static/doctools.js b/sphinx/themes/basic/static/doctools.js_t similarity index 96% rename from sphinx/themes/basic/static/doctools.js rename to sphinx/themes/basic/static/doctools.js_t index ed24a2da3..1700e33bf 100644 --- a/sphinx/themes/basic/static/doctools.js +++ b/sphinx/themes/basic/static/doctools.js_t @@ -124,7 +124,9 @@ var Documentation = { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); + {% if not theme_nonavigationwithkeys|tobool %} this.initOnKeyListeners(); + {% endif %} }, /** @@ -255,26 +257,24 @@ var Documentation = { return path.substring(url.lastIndexOf('/') + 1, path.length - 1); }, - /** - * init onKeyListernes (for navigation) - */ initOnKeyListeners: function() { $(document).keyup(function(event) { - var activeElementType = $(document.activeElement).prop('tagName'); - if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT') { // don't navigate when in search box or textarea + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { switch (event.keyCode) { case 37: // left var prevHref = $('link[rel="prev"]').prop('href'); if (prevHref) { window.location.href = prevHref; + return false; } - return false; case 39: // right var nextHref = $('link[rel="next"]').prop('href'); if (nextHref) { window.location.href = nextHref; + return false; } - return false; } } }); diff --git a/sphinx/themes/basic/theme.conf b/sphinx/themes/basic/theme.conf index f7283730b..f25e0e2a9 100644 --- a/sphinx/themes/basic/theme.conf +++ b/sphinx/themes/basic/theme.conf @@ -5,4 +5,5 @@ pygments_style = none [options] nosidebar = false -sidebarwidth = 230 \ No newline at end of file +sidebarwidth = 230 +nonavigationwithkeys = false \ No newline at end of file