Problem/Motivation
There was a fix made 2 years ago that removed aria-required from radio inputs, since that wasn't an allowed attribute on the radio role. This is still the case in the ARIA spec as well as the W3C Recommendation ARIA in HTML. Webforms using the Likert element still have radio buttons rendering an aria-required attribute, though.
Steps to reproduce
- Spin up a 10.1.x-dev Drupal instance
- Install the Drupal 10 supported version of Webform, 6.2.x. Enable Webform and Webform UI
- Add a Likert form element with some questions rows and answer columns. Under form validation check the required checkbox to make the Likert element required
- When viewing the form, the code inspector shows the radio inputs have both a required and aria-required attribute.

Proposed resolution and benefits
Remove the aria-required attribute from the Likert input element PHP. This will reduce the amount of code needed to convey the same information, if a field is marked as required.
Remaining tasks
Contribute and test a patch removing the attribute (done)Update likert test markup containing aria-required (done)
User interface changes
No known user interface changes. Required setting behaves as usual, only change should be resulting markup.
API changes
Shouldn't be an API change since this is strictly affecting HTML markup--no new variables, functions, classes, etc. should be added.
Data model changes
No data model changes.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3350967-3.patch | 2.68 KB | carlygerard |
| aria-required-likert-form.png | 277.47 KB | carlygerard |
Comments
Comment #2
carlygerardComment #3
carlygerardRemoves the aria-required attribute from the Likert PHP and related test, where it checks for the final markup including aria-required. I think this has all the relevant Likert files from a quick search, but if there are other files I'm missing, that'd be good to know.
There are other webform helper modules where aria-required does appear (Webform Rating, Webform Example, etc.), but not sure if we want to broaden this ticket to include fixes for those files too.
It also appears trying to check against the D10 tests flags a Composer error, it passes in D9 but the D10 error may need a look in a separate ticket.
Comment #4
carlygerardComment #5
carlygerardComment #6
jrockowitz commentedComment #10
jrockowitz commented