- Status changed to Active
11 months ago 2:15am 22 March 2024 - 🇳🇿New Zealand quietone
At Drupal South code sprint. As far as I know this still needs tests and fixes for the pages mentioned in the issue summary.
Added IS template to help others but it still needs to be completed, - 🇨🇦Canada bisonbleu
Just running into this issue in a custom theme. Here is the code sample that generates the «Broken ARIA reference» error:
<!-- BEGIN OUTPUT from 'core/modules/system/templates/input.html.twig' --> <input data-drupal-selector="edit-subscriptions-sip-n-savour" aria-describedby="edit-subscriptions--description" type="checkbox" id="edit-subscriptions-sip-n-savour" name="subscriptions[sip_n_savour]" value="sip_n_savour" class="form-checkbox"> <!-- END OUTPUT from 'core/modules/system/templates/input.html.twig' --> <!-- BEGIN OUTPUT from 'core/modules/system/templates/form-element-label.html.twig' --> <label for="edit-subscriptions-sip-n-savour" class="option">SIP n’ SAVOUR</label>
- 🇨🇦Canada bisonbleu
For the short term, simply adding an ID to the checkbox label does the job; the use case is Simplenews subscriptions on user register page.
/** * Implements template_preprocess_form_element_label(). */ function my_custom_theme_preprocess_form_element_label(&$variables) { $id = $variables['element']['#id'] ?? ''; if ($id && str_contains($id, 'edit-subscriptions-')) { $variables['attributes']['id'] = 'edit-subscriptions--description'; } }