Skip to content

How elements are named in reports ​

Overview ​

When the tool captures an element that has an accessibility problem, it records a readable, human-friendly "name" for it. That name is what appears in the report, so an auditor or a developer can tell at a glance which element needs fixing.


Primary method: the accessibility tree ​

The tool first asks the browser's accessibility tree for the element's name. This is the same information a screen reader would announce, already computed by the browser from labels, ARIA attributes, form relationships, and so on.

This is the most reliable source available, so it is always tried first.


Fallback: naming from the DOM ​

If the accessibility tree returns no name, the tool falls back to the DOM and takes the first of these that produces a value:

  1. Visible text — the element's text content, trimmed.
  2. ID — returned as #<id>.
  3. Class name — returned as a dotted selector.
  4. aria-labelledby — the text of the referenced element.
  5. aria-label — the value of the attribute.
  6. Unknown — if nothing above yields a value, the name is Unknown element.

What this guarantees ​

  • The accessibility tree name is used whenever it exists.
  • When it does not, the fallback order above is followed strictly.
  • If no source produces a name, the reported name is exactly Unknown element.
  • The fallback never fails: missing attributes or malformed HTML produce a name rather than an error.

Why you may see Unknown element ​

A name of Unknown element means the element exposes nothing a person could use to identify it — no accessible name, no text, no id, no class. In practice that is itself a signal worth looking at: an interactive element with no identifiable name is usually the problem being reported.