Skip to content

Commit

Permalink
navigation_with_keys = False (#1503)
Browse files Browse the repository at this point in the history
* navigation_with_keys = False

* None -> False

* Apply suggestions from code review

---------

Co-authored-by: Daniel McCloy <dan@mccloy.info>
  • Loading branch information
gabalafou and drammock committed Oct 16, 2023
1 parent 3dd0bef commit 36847fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
15 changes: 0 additions & 15 deletions docs/user_guide/keyboard-shortcuts.md
Expand Up @@ -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.
```
12 changes: 12 additions & 0 deletions src/pydata_sphinx_theme/__init__.py
Expand Up @@ -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(
Expand Down
Expand Up @@ -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
Expand Down

0 comments on commit 36847fc

Please sign in to comment.