@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

a11y: Set name for ToC button in Diviner and Phriction pages

Summary:
button, link, and menuitem elements should have accessible names per https://dequeuniversity.com/rules/axe/4.10/aria-command-name
This is not the case for the Table of Contents button shown in Diviner articles and Phriction pages.

Add a `<span class="aural-only">Table of Contents</span>` for screenreaders via `setAuralLabel()`.

Refs T16072

Test Plan:
* Go to http://phorge.localhost/book/contrib/article/adding_new_classes/ or http://phorge.localhost/w/whatever/ and inspect the ToC button
* Run an Accessibility check in Chromium Lighthouse and get 93% instead of 89%

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16072

Differential Revision: https://we.phorge.it/D26253

+1
+1
src/view/phui/PHUIDocumentView.php
··· 113 113 ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) 114 114 ->addClass('phui-document-toc') 115 115 ->addSigil('jx-toggle-class') 116 + ->setAuralLabel(pht('Table of Contents')) 116 117 ->setMetaData(array( 117 118 'map' => array( 118 119 $toc_id => 'phui-document-toc-open',