Skip to main content

usemap-references-map

Per the HTML Living Standard, the usemap attribute on an <img> element "must be a valid hash-name reference to a map element" — a # followed by a string that exactly matches the name attribute of a <map> element in the same tree.

Matching is by name, not id, so no-refer-to-non-existent-id — which only tracks id references — never catches a missing or misspelled usemap target. This rule fills that gap.

❌ Examples of incorrect code for this rule

<img src="shapes.png" alt="" usemap="#nonexistent" />

✅ Examples of correct code for this rule

<img src="shapes.png" alt="" usemap="#shapes" />
<map name="shapes">
<area shape="rect" coords="25,25,125,125" href="red.html" alt="Red box." />
</map>

Interface

{
"usemap-references-map": boolean
}

Require that an img element's usemap attribute is a valid hash-name reference to a map element.

Default Severity

error