Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label to honeypot field #259

Open
MikeHarrison opened this issue Mar 1, 2024 · 4 comments
Open

Add label to honeypot field #259

MikeHarrison opened this issue Mar 1, 2024 · 4 comments

Comments

@MikeHarrison
Copy link

Is your feature request related to a problem? Please describe.
When running sites that use Uniform through Pagspeed (https://pagespeed.web.dev), I am getting a Form elements do not have associated labels warning triggered by the honeypot field. I know it doesn't really need one as it is just a bot trap, but it would be good to have one there so this warning isn't triggered. It could simply be the name of the field.

Describe the solution you'd like
Add a label to the honeypot field input

Describe alternatives you've considered
If there is a way for me to do this myself I am happy to give that a go too

@MikeHarrison
Copy link
Author

Hi - just launched a new site and had this warning pop up again which reminded me about this issue! Is it possible to add a label for this?

@mzur
Copy link
Owner

mzur commented Apr 8, 2024

Hi, sorry for being silent for so long. While you can add the label as plain HTML if you need it, the generated honeypot field does not have an id. I'd add an optional id argument to the honeypot_field() helper to make the label/input combination possible. What do you think about that?

@MikeHarrison
Copy link
Author

Hi Martin - no need to apologise! That sounds ideal, I would need to make sure the field was still hidden for screen readers etc. but that is all fine

@mzur
Copy link
Owner

mzur commented Apr 8, 2024

You can reuse the uniform__potty class to hide the label. Would you open a PR with the changes to the helper method and an update to the documentation? I noticed that the documentation for the class argument is also missing so if you would, you could add this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants