@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

a11y: Set aria-label for comment action options dropdown

Summary:
Forms should have a label per https://dequeuniversity.com/rules/axe/4.10/link-select.
This is not the case for the `<select>` element above the comment field which has "Add Action..." as its first option which is created via `id(new AphrontFormSelectControl())` in `PhabricatorApplicationTransactionCommentView`. Add an `aria-label` attribute for screenreader use.

Ref T16072

Test Plan:
* While logged in, go to http://phorge.localhost/T1 or http://phorge.localhost/D1 or http://phorge.localhost/P1
* Inspect the `<select>` element above the comment field (which has "Add Action..." as its first option) with and without this patch.
* Optionally, run an Accessibility check in Chromium Lighthouse.

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/D26051

+20 -3
+1
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
··· 451 451 $action_select = id(new AphrontFormSelectControl()) 452 452 ->addClass('phui-comment-fullwidth-control') 453 453 ->addClass('phui-comment-action-control') 454 + ->setAriaLabel(pht('Comment Action Options')) 454 455 ->setID($action_id) 455 456 ->setOptions($options); 456 457
+15
src/view/form/control/AphrontFormControl.php
··· 3 3 abstract class AphrontFormControl extends AphrontView { 4 4 5 5 private $label; 6 + private $ariaLabel; 6 7 private $caption; 7 8 private $error; 8 9 private $name; ··· 50 51 public function setLabel($label) { 51 52 $this->label = $label; 52 53 return $this; 54 + } 55 + 56 + /** 57 + * Explicitly set an aria-label attribute for accessibility. Only to be used 58 + * when no visible label is already set via setLabel(). 59 + * @param string $aria_label aria-label text to add to the form control 60 + */ 61 + public function setAriaLabel($aria_label) { 62 + $this->ariaLabel = $aria_label; 63 + return $this; 64 + } 65 + 66 + public function getAriaLabel() { 67 + return $this->ariaLabel; 53 68 } 54 69 55 70 public function getLabel() {
+4 -3
src/view/form/control/AphrontFormSelectControl.php
··· 28 28 $this->getValue(), 29 29 $this->getOptions(), 30 30 array( 31 - 'name' => $this->getName(), 32 - 'disabled' => $this->getDisabled() ? 'disabled' : null, 33 - 'id' => $this->getID(), 31 + 'name' => $this->getName(), 32 + 'disabled' => $this->getDisabled() ? 'disabled' : null, 33 + 'id' => $this->getID(), 34 + 'aria-label' => $this->getAriaLabel(), 34 35 ), 35 36 $this->disabledOptions); 36 37 }