Skip to content

element-required-content

Reports an element that lacks a child it requires: <title> in <head>, <summary> in <details>, <head> and <body> in <html>.

A page with no <title> has no name in tabs, history and search results, and a <details> with no <summary> shows a label the browser invents.

To fix, add the missing child.

Reported
...
<details><div></div></details>
<a href="x"><img alt="logo" src="a"></a>
<a href="x">text</a>
<a href="x" aria-label="n"><i></i></a>
...
angular:
lint:
rules:
element-required-content: warn # off (default), warn, error
html:
lint:
rules:
element-required-content: warn # off (default), warn, error
svelte:
lint:
rules:
element-required-content: warn # off (default), warn, error
vue:
lint:
rules:
element-required-content: warn # off (default), warn, error

Enabled by the presets: html/html-validate-standard, html/html-eslint-recommended.

Suppress one line with sudsy-disable-next-line element-required-content in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-eslint require-title partial also requires the other children it lists (<summary> in <details>)
html-validate element-required-content partial the content model of html-validate (data/model.txt); elements that no model row names are not judged