diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -451,6 +451,7 @@ $action_select = id(new AphrontFormSelectControl()) ->addClass('phui-comment-fullwidth-control') ->addClass('phui-comment-action-control') + ->setAriaLabel(pht('Comment Action Options')) ->setID($action_id) ->setOptions($options); diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php --- a/src/view/form/control/AphrontFormControl.php +++ b/src/view/form/control/AphrontFormControl.php @@ -3,6 +3,7 @@ abstract class AphrontFormControl extends AphrontView { private $label; + private $ariaLabel; private $caption; private $error; private $name; @@ -52,6 +53,20 @@ return $this; } + /** + * Explicitly set an aria-label attribute for accessibility. Only to be used + * when no visible label is already set via setLabel(). + * @param string $aria_label aria-label text to add to the form control + */ + public function setAriaLabel($aria_label) { + $this->ariaLabel = $aria_label; + return $this; + } + + public function getAriaLabel() { + return $this->ariaLabel; + } + public function getLabel() { return $this->label; } diff --git a/src/view/form/control/AphrontFormSelectControl.php b/src/view/form/control/AphrontFormSelectControl.php --- a/src/view/form/control/AphrontFormSelectControl.php +++ b/src/view/form/control/AphrontFormSelectControl.php @@ -28,9 +28,10 @@ $this->getValue(), $this->getOptions(), array( - 'name' => $this->getName(), - 'disabled' => $this->getDisabled() ? 'disabled' : null, - 'id' => $this->getID(), + 'name' => $this->getName(), + 'disabled' => $this->getDisabled() ? 'disabled' : null, + 'id' => $this->getID(), + 'aria-label' => $this->getAriaLabel(), ), $this->disabledOptions); }