Skip to main content

HTML Guide

Bad value “” for attribute “aria-labelledby” on element “a”: An IDREFS value must contain at least one non-whitespace character.

Set a non-empty list of valid ID references in the aria-labelledby attribute on the <a> element, or remove the attribute and provide an accessible name another way.

The aria-labelledby attribute takes an IDREFS value: a space-separated list of one or more element IDs, each of which must be non-empty, exist in the document, and be unique. An empty value ("") violates the ARIA/HTML constraints and triggers the validator error. On an <a> element, aria-labelledby supplies the accessible name for the link by concatenating the text from the referenced elements. If you don’t have IDs to reference, use visible link text or aria-label. Avoid leaving aria-labelledby empty (common with templating when a variable is blank); either omit the attribute entirely or populate it with valid IDs. Remember that aria-labelledby overrides other naming methods, so an empty or broken reference can result in a link with no accessible name.

HTML examples

  • Invalid (what triggers the error)

    <a href="/report" aria-labelledby=""></a>
  • Fixed by referencing an existing element with a valid id

    <a href="/report" aria-labelledby="report-link-text">
    <svg aria-hidden="true" viewBox="0 0 16 16"></svg>
    </a>
    <span id="report-link-text">View report</span>
  • Fixed with multiple IDs (space-separated)

    <a href="/apples" aria-labelledby="prefix apples-text">
    <svg aria-hidden="true" viewBox="0 0 16 16"></svg>
    </a>
    <span id="prefix">Learn more: </span>
    <span id="apples-text">Apples</span>
  • Fixed by using visible text content (no ARIA needed)

    <a href="/report">View report</a>
  • Fixed by using aria-label for an icon-only link (when no separate label element exists)

    <a href="/search" aria-label="Search">
    <svg aria-hidden="true" viewBox="0 0 16 16"></svg>
    </a>

Learn more:

Related W3C validator issues