# The “searchbox” role is unnecessary for an “input” element that has no “list” attribute and whose type is “search”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-searchbox-role-is-unnecessary-for-an-input-element-that-has-no-list-attribute-and-whose-type-is-search
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

Every HTML element carries an implicit ARIA role based on its type and attributes. For `<input type="search">` elements that do not have a `list` attribute, the browser automatically exposes the element with the `searchbox` role to assistive technologies. This mapping is defined in the [ARIA in HTML specification](https://www.w3.org/TR/html-aria/), which establishes the correspondence between native HTML semantics and ARIA roles.

When you explicitly add `role="searchbox"` to an element that already carries that role implicitly, the validator raises a warning because the attribute is doing nothing useful. While it won't break functionality, redundant roles clutter your markup and can signal to other developers (or future you) that something special is intended when it isn't. Following the general principle of ARIA — "don't use ARIA if you can use native HTML" — also means not restating what the browser already communicates.

Note the distinction the validator makes: this applies specifically to `<input type="search">` elements **without** a `list` attribute. When a `list` attribute is present (linking the input to a `<datalist>`), the implicit role changes to `combobox`, so in that specific scenario the implicit role is different. However, for a plain search input without `list`, the `searchbox` role is already baked in.

## Why it matters

- **Standards compliance**: The W3C validator flags redundant roles to encourage clean, semantic markup that relies on native HTML behavior.
- **Maintainability**: Redundant attributes add noise. Other developers may wonder why the role was explicitly set and whether removing it would break something.
- **ARIA best practices**: The first rule of ARIA is to use native HTML semantics whenever possible. Restating implicit roles goes against this principle and can mask situations where an explicit role would actually be meaningful.

## How to fix it

Simply remove the `role="searchbox"` attribute from any `<input type="search">` element that does not have a `list` attribute. The browser and assistive technologies will continue to treat it as a search box.

## Examples

### Incorrect — redundant role

The `role="searchbox"` is unnecessary here because `<input type="search">` already implies it:

```html
<label for="site-search">Search the site:</label>
<input type="search" id="site-search" role="searchbox" placeholder="Search...">
```

### Correct — relying on implicit role

Remove the redundant `role` attribute and let native HTML semantics do the work:

```html
<label for="site-search">Search the site:</label>
<input type="search" id="site-search" placeholder="Search...">
```

### Correct — explicit role when implicit role differs

When a `list` attribute is present, the implicit role changes to `combobox`. If you want assistive technologies to treat it as a `searchbox` instead, an explicit role is justified:

```html
<label for="city-search">Search cities:</label>
<input type="search" id="city-search" list="cities" role="searchbox">
<datalist id="cities">
  <option value="Amsterdam">
  <option value="Berlin">
  <option value="Cairo">
</datalist>
```

In this case, the validator will not flag the role as redundant because the implicit role (`combobox`) differs from the explicitly set role (`searchbox`).
