Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error returned when using aria-required/required on radio buttons #36

Closed
scardamalias opened this issue May 19, 2023 · 1 comment
Closed

Comments

@scardamalias
Copy link

Describe the bug

When a set of same-named radio buttons is required, we use an indicator in the LEGEND element, and apply the @required attribute to the INPUTs. ARC Toolkit reports an error once for each radio: "aria-required or required attribute on radio button".

To Reproduce
Scan the sample with ARC Toolkit (the radiogroup role on fieldset doesn't seem to make a difference):

<!DOCTYPE html>
<html lang="en">
<head><title>ARC test of required radios</title></head>

<body>
    <form action="/submit" method="post">
        <fieldset role="radiogroup">
            <legend>Favorite Color*</legend>
            <label><input type="radio" name="color" aria-required="true" required="" value="red" checked/>Red</label>
            <label><input type="radio" name="color" aria-required="true" required="" value="green"/>Green</label>
            <label><input type="radio" name="color" aria-required="true" required="" value="blue"/>Blue</label>
        </fieldset>
        <button type="submit">Submit</button>
    </form>
</body>

</html>

Expected behavior

ARC Toolkit should accept the above markup for required radio button sets.

Screenshots
These indicate how other tools handle the sample:

ARC-radios-axedevtools

Firefox appears to correctly pick up the required state:
ARC-radios-ffaccessibility

ARC-radios-wave

Version information

  • Browser and version: Chrome 113.0.5672.92 (on OSX 13.3.1)
  • ARC Toolkit version: 5.5.3

Additional context

The following resources appear to support the markup we're using. I haven't found any references which would indicate that we're going against the spec in some way.

https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type=radio)

If an element in the radio button group is required, and all of the input elements in the radio button group have a checkedness that is false, then the element is suffering from being missing.

https://html.spec.whatwg.org/multipage/input.html#concept-input-required

To avoid confusion as to whether a radio button group is required or not, authors are encouraged to specify the attribute on all the radio buttons in a group. Indeed, in general, authors are encouraged to avoid having radio button groups that do not have any initially checked controls in the first place, as this is a state that the user cannot return to, and is therefore generally considered a poor user interface.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio

If any radio button in a same-named group of radio buttons has the required attribute, a radio button in that group must be checked

@scardamalias
Copy link
Author

Apologies, I missed #32. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant