From 4e1c7e2ad3b984148f823be0cbd23879a6ba909e Mon Sep 17 00:00:00 2001 From: Gabriel Fouasnon Date: Tue, 10 Oct 2023 15:34:21 +0300 Subject: [PATCH 1/3] navigation_with_keys = False --- docs/user_guide/keyboard-shortcuts.md | 15 --------------- .../theme/pydata_sphinx_theme/theme.conf | 2 +- 2 files changed, 1 insertion(+), 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/theme/pydata_sphinx_theme/theme.conf b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf index 3124424fd..e2efbaa52 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 = False collapse_navigation = False navigation_depth = 4 show_nav_level = 1 From f6624f648e941b99782b66fe4045940dea67396b Mon Sep 17 00:00:00 2001 From: Gabriel Fouasnon Date: Thu, 12 Oct 2023 15:24:19 +0300 Subject: [PATCH 2/3] None -> False --- src/pydata_sphinx_theme/__init__.py | 13 +++++++++++++ .../theme/pydata_sphinx_theme/theme.conf | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index b1b87afef..889c162db 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -50,6 +50,19 @@ 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 ( + hasattr(theme_options, "navigation_with_keys") + and theme_options["navigation_with_keys"] is None + ): + logger.warning( + "The default value for `navigation_with_keys` will change to `False` in the next minor release." + "If you wish to guard the old behavior for your site, set `navigation_with_keys` to `True` in your `theme.conf` 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 e2efbaa52..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 = False +navigation_with_keys = collapse_navigation = False navigation_depth = 4 show_nav_level = 1 From cbf5d03b4f875edb44b884155122bad5886ea33b Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Thu, 12 Oct 2023 09:07:14 -0500 Subject: [PATCH 3/3] Apply suggestions from code review --- src/pydata_sphinx_theme/__init__.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index 889c162db..1e201441d 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -51,13 +51,12 @@ def update_config(app): ) # TODO: in 0.15, set the default navigation_with_keys value to False and remove this deprecation notice - if ( - hasattr(theme_options, "navigation_with_keys") - and theme_options["navigation_with_keys"] is None - ): + 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 minor release." - "If you wish to guard the old behavior for your site, set `navigation_with_keys` to `True` in your `theme.conf` file." + "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" )