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

  1. Spin up a 10.1.x-dev Drupal instance
  2. Install the Drupal 10 supported version of Webform, 6.2.x. Enable Webform and Webform UI
  3. 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
  4. When viewing the form, the code inspector shows the radio inputs have both a required and aria-required attribute.

Firefox dev tools reveal a radio input with an 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.

Comments

CarlyGerard created an issue. See original summary.

carlygerard’s picture

Issue summary: View changes
carlygerard’s picture

StatusFileSize
new2.68 KB

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

carlygerard’s picture

Issue summary: View changes
carlygerard’s picture

Status: Active » Needs review
jrockowitz’s picture

Version: 6.2.x-dev » 6.1.x-dev

  • CarlyGerard authored 18cc7110 on 6.1.x
    Issue #3350967 by CarlyGerard: Required radio buttons in Likert elements...

  • CarlyGerard authored 18cc7110 on 6.x
    Issue #3350967 by CarlyGerard: Required radio buttons in Likert elements...

  • CarlyGerard authored 18cc7110 on 6.2.x
    Issue #3350967 by CarlyGerard: Required radio buttons in Likert elements...
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.