From 36847fc2a816b10eba51415563832ac10341070b Mon Sep 17 00:00:00 2001 From: gabalafou Date: Mon, 16 Oct 2023 19:29:04 +0300 Subject: [PATCH] navigation_with_keys = False (#1503) * navigation_with_keys = False * None -> False * Apply suggestions from code review --------- Co-authored-by: Daniel McCloy --- docs/user_guide/keyboard-shortcuts.md | 15 --------------- src/pydata_sphinx_theme/__init__.py | 12 ++++++++++++ .../theme/pydata_sphinx_theme/theme.conf | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/docs/user_guide/keyboard-shortcuts.md b/docs/user_guide/keyboard-shortcuts.md index c163d47d4..42bfeb93e 100644 --- a/docs/user_guide/keyboard-shortcuts.md +++ b/docs/user_guide/keyboard-shortcuts.md @@ -3,18 +3,3 @@ ## Trigger the search bar You can trigger the search bar pop-up with {kbd}`Ctrl`/{kbd}`⌘` + {kbd}`K`. - -## Change pages - -By default, you can move to the previous/next page using the {octicon}`arrow-left` (left arrow) and {octicon}`arrow-right` (right arrow) keys on a keyboard. -To disable this behavior, use the following configuration: - -```py -html_theme_options = { - "navigation_with_keys": False -} -``` - -```{attention} -Keep in mind that many readers use their keyboards and other assistive technology to interact with web documents. If you disable the keyboard navigation, you might be making your documentaion inaccessible to many readers. -``` diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index b1b87afef..1e201441d 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -50,6 +50,18 @@ def update_config(app): "Use the sphinx-favicon extension instead." ) + # TODO: in 0.15, set the default navigation_with_keys value to False and remove this deprecation notice + if theme_options.get("navigation_with_keys", None) is None: + logger.warning( + "The default value for `navigation_with_keys` will change to `False` in " + "the next release. If you wish to preserve the old behavior for your site, " + "set `navigation_with_keys=True` in the `html_theme_options` dict in your " + "`conf.py` file." + "Be aware that `navigation_with_keys = True` has negative accessibility implications:" + "https://github.com/pydata/pydata-sphinx-theme/issues/1492" + ) + theme_options["navigation_with_keys"] = False + # Validate icon links if not isinstance(theme_options.get("icon_links", []), list): raise ExtensionError( diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf index 3124424fd..de4b5ddc1 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf @@ -23,7 +23,7 @@ favicons = show_prev_next = True search_bar_text = Search the docs ... search_bar_position = sidebar -navigation_with_keys = True +navigation_with_keys = collapse_navigation = False navigation_depth = 4 show_nav_level = 1