Re: Validation error on an input with type search

Marie Hanotte <m.hanotte@acti.fr>, 2015-11-20 11:47 +0100:
> Archived-At: <http://www.w3.org/mid/564EFA3F.6020701@acti.fr>
> 
> When I use the validator on a HTML5 page I'm working on, I get this error :
> *Bad value “search” for attribute “type” on element “input”.*
> 
> I'm a bit surprised, as the reference lists *input type=search* as a valid type :
> http://www.w3.org/TR/html-markup/input.search.html#input.search
> 
> Is there something I am missing here ? I don't know if there is something on
> my side that is not fitting, or if it's a bug in the validator.
> 
> I'm sorry I can't provide a link to my page, as it's not yet publicly
...
>    <form action="/content/search" method="get">
>      <label for="Search">Votre recherche</label>
>      <input type="search" name="SearchText" id="Search" role="search" />

Remove role="search" and that error message should disappear.

The error message being emitted for this case is suboptimal but
unfortunately given the current design of the checker backend, it’s
difficult to improve it.

Basically what’s is saying is, “An input element with role=search can’t
have type=search.” But what we rightly should have it saying instead is “An
input element with role=type can’t have role=search.”

Anyway, as far as I understand ARIA, there is never any need to mark up a
type=search input element with a role attribute. Accessibility tools
already natively/automatically recognize for what it is—a type=search input
element has “implicit semantics” equivalent to either role=textbox or
role=combox, depending on whether it has a “list” attribute or not.

So there’s no need to put role=search on a type=search input element. In
fact, as far as ARIA 1.0 goes, type=search input elements should never have
any role attribute at all. I think role=search is intended for marking up
an entire search form—e.g., at the level of the <form> element.

It looks like ARIA 1.1 adds role=searchbox to mark up the equivalent of a
type=search input element. But I’m not sure that’s supported yet in
accessibility tools—and I think even once it is, you wouldn’t need to used
it explicitly, because I expect the intention is that browsers would
automatically implicitly map type=search input elements to that role.

  —Mike

-- 
Michael[tm] Smith https://people.w3.org/mike

Received on Monday, 23 November 2015 05:50:52 UTC