Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the screen reader experience for html exported notebooks #2137

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tonyfast
Copy link

@tonyfast tonyfast commented Apr 5, 2024

this pull request addresses navigation of rendered html notebooks with assistive technology. it uses the prior work in the notebooks for all project and nbconvert-a11y that test the best semantics for accessible notebooks. it makes minimal visual style changes except for a more significant focus when the cursor's focus is within a cell.

a good way to test these changes is to visit a sample rendering and Tab through the iframe. it will provide similar navigation to the previous version that using tabindex to manage focus.

currently, assistive technology users lack information about the structure of notebooks. this makes for poor experience when navigating notebooks, specifically, large ones. this pull request adds cell navigation using lists, it improves the audible presentation of execution counts, and makes post processing optional.

with list navigation, screen reader users can navigation between cells using I or Shift+I. they can also access quick navigation screens that improve the ability to navigate the faceted nature of notebook documents. each cell contains a visually hidden anchor that offers an interactive element for the keyboard users to Tab through cells. previously, tabbing was achieved using tabindex on the input/output elements. we sunset this approach and rely on an a interactive element for focus. 1

list item navigation of the notebook with the orca screen reader shows fine grained access to cells

further screen reader users can find the cell list when they access the list navigation feature.

list navigation of the notebook with the orca screen reader shows coarse access to the notebook cells

some things to discuss

  • should raw and unknown cells have cell numbers and anchor links?
  • should a code cell announce the kernel name instead of generically calling all cells "code cells"?
  • how should the css be named to comply with the jupyter namespaces better?
  • what is the best way to optionally skip the beautiful soup post processing? is the current approach okay?

cc: @krassowski @bollwyvl

Footnotes

  1. https://www.a11yproject.com/posts/how-to-use-the-tabindex-attribute/#making-non-interactive-elements-focusable

@tonyfast
Copy link
Author

tonyfast commented Apr 5, 2024

FAILED tests/exporters/test_html.py::TestHTMLExporter::test_attachments - assert None
FAILED tests/exporters/test_html.py::TestHTMLExporter::test_png_metadata - assert 0 == 1
FAILED tests/test_nbconvertapp.py::TestNbConvertApp::test_no_input - assert False == ('In\xa0[' not in '<!DOCTYPE html>\n<html lang="en">\n<head><meta charset="utf-8" />\n<meta name="viewport" content="width=device-w...
FAILED tests/test_nbconvertapp.py::TestNbConvertApp::test_no_prompt - assert 'In\xa0[' in '<!DOCTYPE html>\n<html lang="en">\n<head><meta charset="utf-8" />\n<meta name="viewport" content="width=device-width, initial-...

there are four failures associated with this pull request. they stem from two major changes in the PR.

  1. we changed the conformation of the execution counts and they test for them needs to be update with the new accessible representation.
  2. removing the post processing step fails things to do with images that don't have alt text. the add text added in the post process step is not useful for assistive technology users, it appears to satisfy compliance more that assistiveness. these tests will have to be conditional when the postprocess_html trait is True.

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.

None yet

2 participants