@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 project workboard button tooltips as aria-label

Summary:
Dropdown elements should have associated labels per https://www.w3.org/WAI/tutorials/forms/labels/
Setting the JS tooltips for the "Manage" and "Fullscreen" dropdowns also as their `aria-label` is clearly more accessible than exposing no hints at all.

Regarding the implemention,
* `$action->getName()` would return null as no name is set to be rendered in the UI next to the icon.
* introducing `$action->getTooltip()` in `PHUIListItemView` would also return null as this tooltip is created via JavaScript in `PhabricatorProjectBoardViewController` via `PHUIListItemView()->setMetadata()`. Thus do the ugly dance by parsing that very metadata for the sake of more accessibility on project workboards.

Ref T16072

Test Plan: Go to a project workboard, inspect the HTML of the two buttons in the upper right corner for "Manage" and "Fullscreen", see an `aria-label` in the HTML code, have happier screenreader users who appreciate links which have a discernible name.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16072

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

+7
+7
src/view/phui/PHUICrumbsView.php
··· 106 106 $action_classes[] = 'phui-crumbs-action-disabled'; 107 107 } 108 108 109 + $aria_label = null; 110 + $metadata = $action->getMetadata(); 111 + if ($metadata && isset($metadata['tip'])) { 112 + $aria_label = $metadata['tip']; 113 + } 114 + 109 115 $actions[] = javelin_tag( 110 116 'a', 111 117 array( 112 118 'href' => $action->getHref(), 113 119 'class' => implode(' ', $action_classes), 114 120 'sigil' => implode(' ', $action_sigils), 121 + 'aria-label' => $aria_label, 115 122 'style' => $action->getStyle(), 116 123 'meta' => $action->getMetadata(), 117 124 ),