ILIAS icon indicating copy to clipboard operation
ILIAS copied to clipboard

fix: Add aria-describedby to link help-blocks with form inputs.

Open ZallaxDev opened this issue 1 month ago • 1 comments

During accessibility testing of ILIAS 9, help-blocks (bylines) in form fields were not being announced by screen readers. These explanatory texts were visually present but lacked proper ARIA attributes to associate them with their corresponding form inputs, causing screen reader users to miss important contextual information.

This change fixes the issue by programmatically linking help-blocks to their form inputs using the aria-describedby attribute.

Changes:

  • Modified tpl.context_form.html template:

    • Added unique id="{BYLINE_ID}" attribute to help-block div elements
    • Changed fieldset's aria-describedby from single error ID to combined list of IDs
  • Modified Renderer.php in the Input Field component:

    • Updated wrapInFormContext() method to generate unique IDs for bylines
    • Built array of descriptor IDs (byline + error when present)
    • Added new addAriaDescribedByToInput() helper method that injects aria-describedby directly into input/textarea/select elements via regex pattern matching
    • Set aria-describedby on both the input element and fieldset wrapper for maximum compatibility

Note: These changes have broken quite a few tests that need to be fixed.

We have spent some hours fixing them before sending the PR, but due to the high volume of hours needed to complete all the corrections in the tests, we believe it is best that the solution be evaluated to avoid investing unnecessary time in case the solution requires any changes.

Ticket 43925

ZallaxDev avatar Dec 09 '25 17:12 ZallaxDev

Hello!

Thank you very much for all your work. I really appreciate your efforts in this matter. I have just looked at the implementation using a screen reader (NVDA) in the “online” example area. In combination with keyboard control, the area is skipped (it goes immediately to “limited availability period”), i.e., there is no information here that the test cannot be switched to online. A solution needs to be found for this.

If you have the section read aloud, the text “online” is ignored and the checkbox itself is read aloud with “online,” followed by the help text. From my perspective, this is somewhat unfortunate, as the announcement “online” suggests that the test is available online.

Would it make sense to discuss a possible solution together during an online meeting?

Best regards, Annett

Annett7811 avatar Dec 10 '25 11:12 Annett7811