-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Code blocks with :linenos: are not accessible to blind people #7849
Description
Describe the bug
When the screen reader reads the code block, it starts to say "1, 2, 3, 4, 5, 6, ..." and, after all numbers, it reads the code.
To Reproduce
Just create a code block with linenos (and more than one line of code), and try to read it with a screen reader.
Expected behavior
The screen reader will read "1 first line of code, 2 second line of code, ...) or, better, permit to browse the code like a table (with a real table or aria properties).
Environment info
- OS: Linux
- Python version: All
- Sphinx version: 3.1.1
- Sphinx extensions: none
- Extra tools: Firefox or Chromium and Orca
Additional context
The problem here is the structure of the code block. It's generated in a table with a single line. One cell contains all numbers and one all lines of code. It's impossible to the screen reader to associate a number to a line of code, and the user can't get advantage of line numbers. Fixing this can fix issue #1007.