no autocomplete attribute

For technical support and bug reports for all editions of CSS HTML Validator, including htmlval for Linux and Mac.
Post Reply
amir512
Rank 0 - Newcomer
Posts: 4
Joined: Thu May 04, 2023 12:37 pm

no autocomplete attribute

Post by amir512 »

I am using jQuery data table plugin. It automatically generates the code at run time. Your tool is giving warning error for it.
For example the jQuery data table generates the below HTML to search a data in the table.

<label>Search:<input type="search" class="" placeholder="" aria-controls="grid"></label>

CSS HTML Validator Pro 2023 gives the following error for it.

Please advise how to fix it.

This <input> tag has no "autocomplete" attribute. Use a valid and well-formed "autocomplete" attribute wherever possible in order to make the purpose of input fields programmatically determinable [AA, 1.3.5; H98]. Visit https://www.w3.org/WAI/WCAG21/Techniques/html/H98 for more information. This message is displayed up to 5 times.
---
(Accessibility) Placeholder text is generally bad for accessibility. Do not use placeholder text instead of a <label> element (the placeholder text will disappear as soon as the user clicks and/or types and it may cause unexpected technical and usability issues with your content). Visit https://www.nngroup.com/articles/form-d ... ceholders/ for more information. This placeholder text is: "". This message is displayed up to 3 times.
Attachments
SearchError.jpg
SearchError.jpg (159.5 KiB) Viewed 2264 times
User avatar
Albert Wiersch
Site Admin
Posts: 3783
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: no autocomplete attribute

Post by Albert Wiersch »

Hello,

To address the "autocomplete" attribute issue, you can add an "autocomplete" attribute to the <input> element. Here is more information:
Using HTML 5.2 autocomplete attributes
Autofilling form controls: the autocomplete attribute

For a search field, autocomplete="off" may be best. I've also improved the validator message about using "autocomplete" for the next update.

Regarding the "placeholder" attribute message, I've changed the validator to not generate that warning message when it is set to an empty string. This change should be in the next update. For now you can ignore that warning or disable it by right-clicking on the message in the Results Window and choosing 'Disable using Exact Text Match'. This will filter out any validator messages that exactly match the disabled message, so if there is another validator message about placeholder text but it's for different placeholder text (i.e. placeholder="something else"), then that message won't be filtered out because the validator message includes the placeholder text, and thus won't exactly match the message you disabled (because the placeholder text is different).

I hope this helps. Please let me know if you have any more questions.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Albert Wiersch
Site Admin
Posts: 3783
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: no autocomplete attribute

Post by Albert Wiersch »

Hello,

UPDATE: The latest CSS HTML Validator update with the above mentioned changes is now available (v23.0200).
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Post Reply