pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/148751

ref="https://github.githubassets.com/assets/actions-0e714a98ea09295a.css" /> Enable keyboard navigation for Python docs by abitrolly · Pull Request #148751 · python/cpython · GitHub
Skip to content

Enable keyboard navigation for Python docs#148751

Open
abitrolly wants to merge 2 commits intopython:mainfrom
abitrolly:patch-1
Open

Enable keyboard navigation for Python docs#148751
abitrolly wants to merge 2 commits intopython:mainfrom
abitrolly:patch-1

Conversation

@abitrolly
Copy link
Copy Markdown

@abitrolly abitrolly commented Apr 19, 2026

You can test how it works before this change by opening JavaScript console with F12 and setting

DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS = true

then make sure the focus is in the main are and press Left on the keyboard.

The option is documented here https://www.sphinx-doc.org/en/master/usage/theming.html#:~:text=navigation%5Fwith%5Fkeys


📚 Documentation preview 📚: https://cpython-previews--148751.org.readthedocs.build/

You can test how it works before this change by setting
DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS = true
in JavaScript console and press Left on the keyboard.
@bedevere-app
Copy link
Copy Markdown

bedevere-app bot commented Apr 19, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@hugovk
Copy link
Copy Markdown
Member

hugovk commented Apr 19, 2026

Copying my comment from python/devguide#1784 (comment):


Nice little shortcut, but I'm concerned this will interfere with keyboard handling for people using assistive tech such as screen readers.

https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/ includes:

So, screen reader users will commonly expect that pressing the right arrow key will expand a collapsed node.

https://webaim.org/techniques/keyboard/ has examples where / keys are needed.

@abitrolly
Copy link
Copy Markdown
Author

Nice little shortcut, but I'm concerned this will interfere with keyboard handling for people using assistive tech such as screen readers.

https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/ includes:

So, screen reader users will commonly expect that pressing the right arrow key will expand a collapsed node.

https://webaim.org/techniques/keyboard/ has examples where / keys are needed.

@hugovk keyboard shortcuts are disabled for these HTML elements - "TEXTAREA", "INPUT", "SELECT", "BUTTON" (https://github.com/sphinx-doc/sphinx/blob/cc7c6f435ad37bb12264f8118c8461b230e6830c/sphinx/themes/basic/static/doctools.js#L6-L11)

Is that enough for Python docs? The ARIA guidelines are too generic - they say "Consider, for example, a screen reader user operating a tree.", but as far as I can tell there are no expandable trees in Python docs.

@hugovk
Copy link
Copy Markdown
Member

hugovk commented Apr 19, 2026

My understanding is that screen readers use left and right to navigate character-by-character:

For example the left/right cursor keys are intercepted and used to move focus to the previous/next character in the content, and the up/down keys move focus to the previous/next line instead of scrolling the page.

https://tink.uk/understanding-screen-reader-interaction-modes/

While using screen reader such as NVDA, when left or right key is pressed, the screen reader reads the current or next element letter by letter.

https://stackoverflow.com/questions/70304270/while-using-screen-reader-such-as-nvda-how-to-press-left-or-right-key

Or for navigating table cells:

https://dequeuniversity.com/screenreaders/nvda-keyboard-shortcuts

So any other interception of arrow keys would be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy