Hands-on session 4: Making computational notebooks accessible
This session focusses on accessibility of computational notebooks. Computational notebooks are essential in computational biology. They are used to interact and present data. In this session, we focus on Jupyter Notebooks, as they are one of the most widely used type of notebooks, but these principles extend to other types of notebooks as well. As with other documents, notebooks should also be Perceivable, Operable, Understandable, and Robust.
Notebooks used in this session
This session uses the following notebooks:
- Notebook with guidelines Google Colab, download and HTML page
- Exercise on squidpy tutorial Google Colab, download and HTML page
Current state of accessibility in notebooks
Potluri et al., 2023, assessed 100000 notebooks for accessibility, of which 92050 Python notebooks. We highlight a few findings:
- They found that 42.95% of notebooks have at least 1 programmatic figure, of which 99.81% do not have alt text. Of the 609 images with alt text, only 1 is generated with code, while the rest are added with markdown. Most of these alt texts are not useful (e.g., “image”, “colab”, “png”). So, most figures are not accessible through text.
- They found that 34.1% of notebooks had at least one table, so a vast majority of the notebooks do not display their data in a tabular way. Only 4.53% of notebooks had a table close to a figure, suggesting accompanying data with a figure. The average table has 15 rows and 140 columns, or 2100 cells.
- They found that 28.90% notebooks had a
<h1>
element in their first cell.
How to make your notebooks accessible
Here, we focus on three themes to make your notebook more accessible:
- Navigability (landmarks, notebook size, links). This ensures a notebook is perceivable and operable. Someone needs to be able to navigate the notebook, e.g. by using proper headings.
- Data interpretability (figures, tables). This ensures a notebook is perceivable and understandble. By providing the data in manageable and annotated tables and providing alternative texts for figures, someone can explore the data patterns even without seeing these.
- Exporting (format, theme). Our main focus is on navigability and data interpretability, but we will also highlight how exporting a notebook can have a big impact on its accessibility.
Checklist
As part of this tutorial, we provide the following checklist. This checklist does not guarentee full accessibility, but rather is meant to give a quick hands-on method to directly improve the accessibility of your notebooks.
- Single
<h1>
element at the top of the notebook - First cell explains the background of the notebook
- Rest of the notebook is structures with
<h2>
-<h6>
elements - Markdown and code comments explain the notebook
- Expected errors are marked
- Links have a descriptive name
- Table of the data is included
- Tables have a caption
- Tables have limited number of rows and columns
- Static images have alt text
- Dynamic images have alt text where possible
- Notebook is not too long
- An HTML version of the notebook is available if possible
References
- Project Notebooks For All
- Tutorial Accessible Pandas DataFrames
- Repository Jupyter Accessibility
- Repository MatplotAlt and documentation
- Paper of survey of notebook accessibility - Potluri et al., 2023
- Slides of notebook best practises - Isabela Presedo-Floyd, 2023
- Tutorial for making Computational Notebooks accessible