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.

Description

A figure may have a figcaption at the beginning or end of its direct element children.

A figure may have a figcaption at the beginning or end of its direct element children. The caption is optional, but multiple captions or a middle placement violate this local structure.1

The tool returns captionCount, captionIndex, validPlacement. The fields describe the supplied local pattern or effective state, or contain the formatted markup shown below.

When to use figure/figcaption Pairing Check

Use this for the following task: 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. Provide the requested local fields extracted from the relevant element or attribute.

How to use figure/figcaption Pairing 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 captionCount, captionIndex, validPlacement. 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 the direct element-child names in document order. Fold ASCII case, count figcaption and report its first zero-based index, or −1 if absent.

validPlacement = no caption OR exactly one caption at index 0 or final index

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
captionCountCaption Countinteger
captionIndexCaption Indexinteger
validPlacementValid Placementboolean
json
{
  "input": {
    "children": [
      "img",
      "figcaption"
    ]
  },
  "output": {
    "captionCount": 1,
    "captionIndex": 1,
    "validPlacement": true
  }
}

Limitations and assumptions

Ignore text and comment nodes when preparing the list. Other content-model rules, caption quality and complete accessibility are not checked.

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 fieldset/legend A11y Pair Check when you need its operation: 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. Choose details/summary Native Disclosure for the complementary operation: Reports whether details body content is exposed by the open attribute and which direct summary element is the native summary (the first one). Structural placement is reported separately from disclosure state.

Background reference: HTML Standard: figure/figcaption Pairing Check.

References

  1. HTML Standard: figure/figcaption Pairing Check — WHATWG

Similar or alternative tools

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

  • details/summary Native Disclosure

    Reports whether details body content is exposed by the open attribute and which direct summary element is the native summary (the first one). Structural placement is reported separately from disclosure state.

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