We'd like to set Google Analytics cookies to learn how people use the Knowledge Base, so we can improve it. We set them only if you accept.

Skip to main content
Digital Accessibility Knowledge Base

suspicious-semantics

Web validation

Navigation-type roles should not be applied to elements that look like forms.

The navigation, menubar, menu, and tablist roles tell screen reader users what to expect inside an element: links to other pages, menu items, or tabs. When one of these roles is applied to a form, such as a search box or a group of form fields with a submit button, the announcement doesn't match the content. Users expect to move through links, menu items, or tabs, and find form fields instead. They may misunderstand the content, or not know how to interact with it.

A menu, menubar, or tablist role can also change how screen readers handle keyboard input, because these widgets are expected to manage their own arrow keys. Inside one of them, form fields can be harder to reach and fill in.

Evinced reports this issue when an element has the navigation, menubar, menu, or tablist role, but it looks like a form.

To fix the issue:

  • If the element is a form, remove the navigation-type role. Use a <form> element with an accessible name, or role="search" for a search form.
  • If a navigation area also contains a form, for example a search field in the site header, apply the navigation role to the navigation part only, and place the form in its own <form> or search landmark.

Pass Patterns

Search form with the search role

The form is exposed as a search landmark, and its field and button keep their own roles.

HTML
<form role="search" aria-label="Site">
    <label for="site-search">Search</label>
    <input type="search" id="site-search" />
    <button>Search</button>
</form>

The header holds a navigation landmark for its links, and a separate search landmark for the search form.

HTML
<header>
    <nav aria-label="Main">
        <ul>
            <li><a href="/">Home</a></li>
            <li><a href="/products">Products</a></li>
        </ul>
    </nav>
    <form role="search" aria-label="Site">
        <label for="site-search">Search</label>
        <input type="search" id="site-search" />
        <button>Search</button>
    </form>
</header>

Fail Patterns

Search form with the navigation role

The element contains only a search field and a button, but the navigation role tells screen reader users it's a navigation area.

HTML
<div role="navigation">
    <label for="site-search">Search</label>
    <input type="search" id="site-search" />
    <button>Search</button>
</div>

Sign-up form with the menubar role

The form is announced as a menu bar, so users expect menu items and arrow key navigation, but find form fields.

HTML
<form role="menubar">
    <label for="email">Email address</label>
    <input type="email" id="email" />
    <button>Subscribe</button>
</form>

WCAG techniques

Sufficient techniques

Try It Yourself

Using a screen reader

New to screen reader testing, or need a refresher?
Review this article first: Practical guides for using screen readers

  1. Load the page and open a screen reader.
  2. Move into the form, and listen to what the screen reader announces.
  3. Try to fill in the form fields.

Expected results: The screen reader announces a form or a search area, and then the form fields.

Actual results: The screen reader announces a navigation area, a menu, or a set of tabs, and then form fields that don't match that announcement.

Inspecting the browser dev-tools

  1. In your browser's dev tools, select the element that contains the form and open the Accessibility panel.
  2. Check the element's role.

Expected results: The role is form, search, or a generic role.

Actual results: The role is navigation, menubar, menu, or tablist.

FAQ

How does this issue relate to 1.3.1 Info and relationships?

SC 1.3.1 requires the structure and relationships conveyed visually to be available programmatically, and to match what users see. A form that is exposed as a navigation area, menu, or set of tabs conveys a structure that doesn't match its content, so screen reader users get the wrong picture of it.

Why is this issue marked as Moderate?

The form fields are still exposed and usually still work, but the misleading role confuses screen reader users about what the element is and how to use it. It can make the form harder to fill in, though rarely impossible, so the issue is rated moderate.

Can a navigation area contain a search field?

Many site headers combine navigation links with a search field. Keep the navigation role on the part that holds the links, and put the search form in its own search landmark next to it, so each part is announced for what it is.

Standards and Regulations

StandardSuccess CriterionReference
WCAG 2.21.3.1 Info and Relationships (A)Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text.
EN 301 5499.1.3.1 Info and RelationshipsSame as the WCAG text.

Personas impacted by this issue

Learn More