Developer forum

Forum » CMS - Standard features » Form hidden fields are type="text"

Form hidden fields are type="text"

Mafalda Correa
Mafalda Correa
Reply

Hi,

I noticed there's some fields in the forms that are type="text" and then hidden with CSS, instead of being type="hidden".

Is there a reason why these fields need to be type="text"?

Being a text field, they get picked up by accessibility (WCAG/ADA) tools that report them as errors because they don't have labels.

 

 

Thank you


Replies

 
Nicolai Pedersen
Reply

They are part of the antispam feature of forms. They are hidden with display:none so screenreaders will not evalutate them.

We can consider adding aria-label for the fields to get your green mark on the tests https://www.w3.org/WAI/tutorials/forms/labels/#using-aria-label

 
Mafalda Correa
Mafalda Correa
Reply

Hi Nicolai,

Yes, they are not technically an issue for screen readers, yet they get flagged by some tests.

I was wondering if there is a reason why they are not type="hidden", because that's how I was planning on fixing it, but if that creates any issues with code, I'll simply add an aria-label instead.

 
Nicolai Pedersen
Reply

Because like the testing tool, bots will make mistakes when the field is not of type=hidden and can then be used to catch bots.

 
Mafalda Correa
Mafalda Correa
Reply

Thank you for the explanation.

Could we then get an aria-label added to those fields so that they don't get picked up by accessibility testing tools? I'll make the change necessary to my project now, but if in the future that could come directly from DW.

 

You must be logged in to post in the forum