Page tree
Skip to end of metadata
Go to start of metadata

Description

The Search input element does not have an associated label element, the title attribute is used instead.

Example:

<input type="text" maxlength="128" name="search_theme_form" id="edit-search-theme-form-1" size="15" value="" title="Search this site" 
class="form-text hint-enabled hics_hilite"> 
 

Checkpoint:

Form Control Labels (WCAG2)

Message:

Labels are the preferred method over Titles. Use title only when the visual design cannot accommodate the label.

Note: Title should only be used to add supplement information to an input element and should not be the same text as the label.


Fix

An input element of type text should always have a label. If the label is visible, a for attribute is added to the label element and a matching ID on the input element itself.

Example:

<label for="search">
<input type="text" id="search"> 

 

If for design reasons there is no visible label, add the aria-label attribute to the input element and the name of the label as the value.

Example:

<input type="text" aria-label="search"> 

 

  • No labels