fieldset/legend A11y Pair Check
Checks a fieldset direct-element-child list for a single legend in first position. A legend is optional in HTML; this check reports the structural pairing without claiming complete accessibility.
Description
A legend labels a fieldset’s group of controls.
A legend labels a fieldset’s group of controls. When present as a direct element child, the single legend belongs first; its absence is permitted by the structural check.1
The tool returns legendCount, legendFirst, validPlacement, hasLegend. The fields describe the supplied local pattern or effective state, or contain the formatted markup shown below.
When to use fieldset/legend A11y Pair Check
Use this for the following task: Checks a fieldset direct-element-child list for a single legend in first position. A legend is optional in HTML; this check reports the structural pairing without claiming complete accessibility. Provide the requested local fields extracted from the relevant element or attribute.
How to use fieldset/legend A11y Pair Check and understand its results
- Prepare the parsed element names, attribute values or direct element-child lists requested below. Keep attribute presence separate from its value.
- Enter children according to the field table, then run the tool.
- Read legendCount, legendFirst, validPlacement, hasLegend. Check the effective state, recognized-token flags or generated markup against the rules below.
- Correct any reported local mismatch and check the resulting markup in its intended document and browser context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| children | Children | list of string; minimum entries 0; maximum entries 10000; each entry: maximum text length 10000 | Required |
Supply direct element-child names in document order. Fold ASCII case, count legend and return legendFirst, hasLegend and the placement flag.
validPlacement = no legend OR one legend first The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| legendCount | Legend Count | integer |
| legendFirst | Legend First | boolean |
| validPlacement | Valid Placement | boolean |
| hasLegend | Has Legend | boolean |
{
"input": {
"children": [
"legend",
"input",
"button"
]
},
"output": {
"legendCount": 1,
"legendFirst": true,
"validPlacement": true,
"hasLegend": true
}
} Limitations and assumptions
Text/comment nodes should be excluded. A structurally valid result does not establish an accessible group name or assess control labels.
The tool does not fetch a page, run a browser or validate an entire HTML document. Malformed tool requests produce input errors; valid requests can still report unrecognized values or failed local checks.
Alternative or Complementary methods
Choose figure/figcaption Pairing Check when you need its operation: Checks figure direct-element children for at most one figcaption at either end. Missing figcaption is allowed; caption content quality and accessibility are outside this structural check. Choose select/optgroup Nesting Rules Check for the complementary operation: Checks direct parent relationships for option and optgroup elements in the classic select profile. Customizable selects, datalist options and intervening div elements are outside this explicitly restricted profile.
Background reference: HTML Standard: fieldset/legend A11y Pair Check.
References
Similar or alternative tools
- figure/figcaption Pairing Check
Checks figure direct-element children for at most one figcaption at either end. Missing figcaption is allowed; caption content quality and accessibility are outside this structural check.
- select/optgroup Nesting Rules Check
Checks direct parent relationships for option and optgroup elements in the classic select profile. Customizable selects, datalist options and intervening div elements are outside this explicitly restricted profile.