diff --git a/CHANGES b/CHANGES index 7e8d70b2b..5e6be0013 100644 --- a/CHANGES +++ b/CHANGES @@ -82,6 +82,9 @@ Bugs fixed module members without :impoprted-members: option * #6889: autodoc: Trailing comma in ``:members::`` option causes cryptic warning * #7055: linkcheck: redirect is treated as an error +* #7088: HTML template: If ``navigation_with_keys`` option is activated, + modifier keys are ignored, which means the feature can interfere with browser + features * #7090: std domain: Can't assign numfig-numbers for custom container nodes Testing diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index 3b42bc4cb..5ed9f1f1b 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -151,6 +151,10 @@ These themes are: dimension string such as '70em' or '50%'. Use 'none' if you don't want a width limit. Defaults may depend on the theme (often 800px). + - **navigation_with_keys** (true or false): Allow navigating to the + previous/next page using the keyboard's left and right arrows. Defaults to + ``False``. + **alabaster** `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz (especially as used in his Requests project), which was itself originally diff --git a/sphinx/themes/basic/static/doctools.js b/sphinx/themes/basic/static/doctools.js index ddca10ca3..daccd209d 100644 --- a/sphinx/themes/basic/static/doctools.js +++ b/sphinx/themes/basic/static/doctools.js @@ -283,10 +283,11 @@ var Documentation = { }, initOnKeyListeners: function() { - $(document).keyup(function(event) { + $(document).keydown(function(event) { var activeElementType = document.activeElement.tagName; // don't navigate when in search box or textarea - if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' + && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { switch (event.keyCode) { case 37: // left var prevHref = $('link[rel="prev"]').prop('href');