@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.

AphrontFormPolicyControl: Reuse existing control ID

Summary:
Do not unconditionally create a new ID which breaks the accessibility label.

Parent `AphrontFormControl::render()` set an ID via `$this->setID(celerity_generate_unique_node_id())` and then calls `$this->renderInput()` on its subclass `AphrontFormPolicyControl` which unconditionally runs `$control_id = celerity_generate_unique_node_id()` to assign another ID and then does `'id' => $control_id`.
This breaks accessibility (AphrontFormControl's `label for="UQ0_xx"` is now off by one from AphrontFormPolicyControl's `a id="UQ0_xx"`).

Similar existing code can be found in `AphrontFormTokenizerControl::renderInput()` at https://we.phorge.it/source/phorge/browse/master/src/view/form/control/AphrontFormTokenizerControl.php;bccd4f5981a7e2c347e8e26cf24d8394c882724f$57-61

Closes T16019

Test Plan: Create a Maniphest Task form which exposes policy controls. Check the resulting HTML if `<label for="">` and `<a id="">` match.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16019

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

+5 -1
+5 -1
src/view/form/control/AphrontFormPolicyControl.php
··· 244 244 $this->setValue($policy); 245 245 } 246 246 247 - $control_id = celerity_generate_unique_node_id(); 247 + if ($this->getID()) { 248 + $control_id = $this->getID(); 249 + } else { 250 + $control_id = celerity_generate_unique_node_id(); 251 + } 248 252 $input_id = celerity_generate_unique_node_id(); 249 253 250 254 $caret = phutil_tag(