squizlabs/HTML_CodeSniffer

question to principle4.guideline4_1.4_1_2.h91.inputtext.name

LuciaLux opened this issue · 1 comments

I have this input

<input _ngcontent-c1="" autocomplete="off" id="searchInput" name="query" required="" type="text" placeholder="Cerca" class="ng-untouched ng-pristine ng-invalid">

and the following error is generated:

Principle4.Guideline4_1.4_1_2.h91.InputText.Name 
THIS TEXTINPUT ELEMENT DOES NOT HAVE A NAME AVAILABLE TO AN ACCESSIBILITY API. VALID NAMES ARE: LABEL ELEMENT, TITLE UNDEFINED, ARIA-LABEL UNDEFINED, ARIA-LABELLEDBY UNDEFINED.

my question is:
the value given to the title, the ARIA-LABEL and the ARIA-LABELLEDBY, ie undefined, is correct?

The error looks correct to me. From the example you posted there is no programatic way to determine what accessible text is available. I'd suggest looking at the WCAG guidelines for possible remediations. The technique might not be exactly what you are after from the error message, but this should help: https://www.w3.org/WAI/WCAG22/Techniques/html/H44