definition-list-children-valid

Description lists must be structured correctly

automaticWCAG 1.3.1 (A)confidence: highseverity: seriousperceivable

Checks that <dl> elements only directly contain <dt>/<dd> groups (optionally wrapped in one <div>), <script>, <template>, or <style>.

Applies to. Applies to <dl> elements that have at least one direct element child.

Expectation. Every direct element child is <dt>, <dd>, <script>, <template>, <style>, or a <div> whose own children are drawn from that same set (a single level of wrapping div is allowed, matching how authors commonly group dt/dd pairs). If the flattened set contains any <dt> or <dd> at all, it must contain BOTH (an unbalanced dt-without-dd or dd-without-dt is invalid). A flattened set with neither is vacuously fine, not a violation (see implementation-notes). Any other direct or wrapped child breaks the description-list semantics assistive technologies rely on.

Examples

pass
<dl>
<dt>Term</dt>
<dd>Definition</dd>
</dl>

`<dl>`'s only direct children are `dt`/`dd`.

fail
<dl>
<dt>Term</dt>
<dd>Definition</dd>
<p>oops</p>
</dl>

The `<p>` is a direct child of `<dl>` that isn't `dt`/`dd` (or an allowed wrapper).

View source