Skip to content

Dropping hard-coded style="display:none" in favor of custom class#56

Draft
ThomasLandauer wants to merge 1 commit into
omines:masterfrom
ThomasLandauer:patch-3
Draft

Dropping hard-coded style="display:none" in favor of custom class#56
ThomasLandauer wants to merge 1 commit into
omines:masterfrom
ThomasLandauer:patch-3

Conversation

@ThomasLandauer

Copy link
Copy Markdown
Contributor

Right now, the HoneypotType has style="display:none" hard-coded. Don't you think that this is really easy to detect for spambots?

So my idea would be to use a CSS class for that, with a name chosen by the user. So I'd add something like this to the recipe:

attributes:
    class: 'noShow' # change this to some other name to make it harder to detect for spambots

What do you think?

…ble `class`

Right now, the `HoneypotType` has `style="display:none"` hard-coded. Don't you think that this is really easy to detect for spambots?

So my idea would be to use a CSS `class` for that, with a name chosen by the user. So I'd add something like this to the recipe:

```yaml
attributes:
    class: 'noShow' # change this to some other name to make it harder to detect for spambots
```
@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (dec5fed) to head (4435d79).

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #56   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       203       203           
===========================================
  Files             26        26           
  Lines            590       590           
===========================================
  Hits             590       590           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@curry684

Copy link
Copy Markdown
Member

I don't mind having a config option for it, but in my experience the current mechanism works fine. Hidden fields, either through `type="hidden" or CSS, are used all the time for valid reasons like remembering context for contact forms, return URLs, CSRF fields et al. So specifically a spambot has to be really smart to realize that this specific element should be left empty, while the CSRF tokens and redirect URLs should not.

I'll merge the PR if done right as there is added value, but limited.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants