Opened 20 months ago

Last modified 23 hours ago

#35874 assigned Bug

The console directive is not accessible for screenreaders.

Reported by: Sarah Boyce Owned by: James Beard
Component: Documentation Version: dev
Severity: Normal Keywords: accessibility, sphinx, sphinx-theme
Cc: accessibility Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by James Beard)

docs._ext.djangodocs.visit_console_html generates the HTML for the console directive in docs and has buttons for Linux/MacOS and Windows

This is not very screen reader friendly.
The main issues are that the labels are not read out properly (it should read out the current title but is reading the content of &#xf17c/&#xf179).
That these are clickable and what happens when you click them are also not clear.

I think it might be better to turn this into tabs: https://www.w3.org/WAI/ARIA/apg/patterns/tabs/examples/tabs-manual/

Some examples in docs: https://docs.djangoproject.com/en/5.1/intro/contributing/#getting-a-copy-of-django-s-development-version
Example html:

<div class="console-block" id="console-block-0">
<input class="c-tab-unix" id="c-tab-0-unix" type="radio" name="console-0" checked="">
<label for="c-tab-0-unix" title="Linux/macOS">/</label>
<input class="c-tab-win" id="c-tab-0-win" type="radio" name="console-0">
<label for="c-tab-0-win" title="Windows"></label>
<section class="c-content-unix" id="c-content-0-unix" style="display: block;">
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/YourGitHubName/django.git
</pre></div>
</div>
</section>
<section class="c-content-win" id="c-content-0-win" style="display: none;">
<div class="highlight"><pre><span></span><span class="gp">...\&gt;</span> git clone https://github.com/YourGitHubName/django.git
</pre></div>
</section>
</div>

Change History (6)

comment:1 by Sarah Boyce, 20 months ago

Type: UncategorizedBug

comment:2 by Tom Carrick, 20 months ago

Keywords: accessibility added
Triage Stage: UnreviewedAccepted

comment:3 by Johanan Oppong Amoateng, 20 months ago

Owner: set to Johanan Oppong Amoateng
Status: newassigned

comment:4 by Ahmed Nassar, 14 months ago

Owner: changed from Johanan Oppong Amoateng to Ahmed Nassar

Due to the owner's inactivity. I will be happy to work on this ticket.

comment:5 by James Beard, 9 days ago

Description: modified (diff)
Owner: changed from Ahmed Nassar to James Beard

Will make some improvements. Brief game plan:

  1. make the tabs look much more tab like
  2. make the generated HTML more screen reader friendly
  3. change the hover cursor to provide some visual feedback that tabs are clickable
  4. leave tabs as form inputs to retain css only presentation of the active block
  5. tidy up the layout of the block to match plain python pre-formatted code (padding on all sides, etc)

R.e. item 4, am going to assume if moving to something more semantic like <button> for the tabs required Javascript (think it might) we'd prefer not to do that.

comment:6 by Mike Edmunds, 23 hours ago

Keywords: sphinx sphinx-theme added

If any CSS changes are needed, note that docs.djangoproject.com uses its own _console-tabs.scss, not the CSS from django/docs/_theme/djangodocs/static. (In #37138 I'm creating an updated "djangoproject" Sphinx theme that shares the scss from djangoproject.)

Note: See TracTickets for help on using tickets.
Back to Top