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

Test procedure in H71 doesn't require legend to be first child #3090

Closed
dd8 opened this issue Mar 6, 2023 · 1 comment · Fixed by #3096
Closed

Test procedure in H71 doesn't require legend to be first child #3090

dd8 opened this issue Mar 6, 2023 · 1 comment · Fixed by #3096

Comments

@dd8
Copy link

dd8 commented Mar 6, 2023

The description of H71 says "The first element inside the fieldset must be a legend element" but the test procedure doesn't mention this and passes no matter where the legend is positioned:

For groups of related controls where the individual labels for each control do not provide a sufficient description, and an additional group level description is needed:
Check that the group of logically related input or select elements are contained within fieldset elements.
Check that each fieldset has a legend element that includes a description for that group.

https://www.w3.org/WAI/WCAG21/Techniques/html/H71

The HTML Standard specifies that legend must be the first element in the fieldset if present:
https://html.spec.whatwg.org/multipage/form-elements.html#the-legend-element

If the legend is the first child the fieldset is mapped to a group named "First child" in Chrome/Firefox/Safari:

  <fieldset>
      <legend>First child</legend>
      <input aria-label="Search">
  </fieldset>

If the legend is embedded in some divs, it passes the H71 test procedure, but the fieldset is mapped to an unnamed group in Chrome/Firefox/Safari:

  <fieldset>
    <div><div><legend>First non-generic element</legend></div></div>
    <input aria-label="Search">
  </fieldset>

Suggested fix - change:

Check that each fieldset has a legend element that includes a description for that group

to

Check that each fieldset has a legend element that is the first child in the fieldset and includes a description for that group

or

Check the first child in each fieldset is a legend element that includes a description for that group

@dd8 dd8 changed the title Test procedure in H71 Test procedure in H71 doesn't require legend to be first child Mar 6, 2023
detlevhfischer added a commit that referenced this issue Mar 8, 2023
Modify test section to include the requirement that legent is first child in fieldset
Coses  #3090
@detlevhfischer
Copy link
Contributor

Well spotted. I have created a PR to change this: #3096

@detlevhfischer detlevhfischer self-assigned this Mar 8, 2023
mbgower pushed a commit that referenced this issue Jul 10, 2024
Modify test section to include the requirement that legend is first
child in fieldset, as is technically required

Closes  #3090

---------

Co-authored-by: Francis Storr <francis.storr@intel.com>
Co-authored-by: Patrick H. Lauke <redux@splintered.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants