About This HTML Issue
The dir attribute on an <input> element is set to an empty string, and dir only accepts ltr, rtl or auto.
dir sets the direction of the text inside the field. The HTML standard treats an empty or unknown value as if the attribute were missing, so the input takes its direction from its parent and dir="" changes nothing. A bare dir with no value counts as empty too, and gets the same error.
A template that fills dir from the page language can print it empty for left-to-right languages. If the field should follow the page direction, remove the attribute. If people may type in a right-to-left script such as Arabic or Hebrew, which is common in search boxes, use dir="auto" and the browser sets the direction from the first letter typed. Add dirname when the server needs that direction too. The form then submits it as an extra field, such as q.dir=rtl.
Invalid example
<form action="/search">
<input type="search" name="q" aria-label="Search" dir="">
</form>
Valid example
Remove the attribute so the field follows the page direction:
<form action="/search">
<input type="search" name="q" aria-label="Search">
</form>
Or let the field follow the text the user types:
<form action="/search">
<input type="search" name="q" aria-label="Search" dir="auto" dirname="q.dir">
</form>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.