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

  1. Prepare the parsed element names, attribute values or direct element-child lists requested below. Keep attribute presence separate from its value.
  2. Enter children according to the field table, then run the tool.
  3. Read legendCount, legendFirst, validPlacement, hasLegend. Check the effective state, recognized-token flags or generated markup against the rules below.
  4. Correct any reported local mismatch and check the resulting markup in its intended document and browser context.
Input fieldMeaningValue type and boundsRequirement
childrenChildrenlist of string; minimum entries 0; maximum entries 10000; each entry: maximum text length 10000Required

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 fieldMeaningValue type
legendCountLegend Countinteger
legendFirstLegend Firstboolean
validPlacementValid Placementboolean
hasLegendHas Legendboolean
json
{
  "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

  1. HTML Standard: fieldset/legend A11y Pair Check — WHATWG

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.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies