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

Auto-add mailto: prefix onchange #83

Merged
merged 4 commits into from
Jul 15, 2021

Conversation

joker314
Copy link
Contributor

Resolves #81 (comment)

Blurring the input in any way will check if the Contact input is in the form user@domain, where each of user and domain have length at least 1 and contain only alphanumeric characters

  • A-Z
  • 0-9
  • _
  • +
  • .
  • -

If it matches, then the prefix mailto: is added.

I'm not sure how useful this change will be because the validation error is shown as the user is typing, so they may try to fix it themselves instead of blurring the input. @nightwatchcyber / @rugk do you think it would be better to check after each key press (or more precisely, 'oninput')?

Copy link

@rugk rugk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful this change will be because the validation error is shown as the user is typing

IMHO, yes, this is definitively a big problem.

do you think it would be better to check after each key press (or more precisely, 'oninput')?

If that solves the above problem, yes, it may be a way to go.

Otherwise some UX ideas:

  • prevent the validation trigger until the focus is lost (blur) and only then also add the mailto: prefix, if needed (before validation of course)
  • defer validation for some ms or so (to be tested if that makes sense)
  • or add two validations (one for not-yet-complete emails and one for complete validation at the end)

That just as some brainstorming… it all comes down to testing the ideas.

js/genform.js Outdated Show resolved Hide resolved
@joker314
Copy link
Contributor Author

Hi @rugk

I went with this option, which I think works really well and avoids any red appearing on the screen in most cases, which is great

prevent the validation trigger until the focus is lost (blur) and only then also add the mailto: prefix, if needed (before validation of course)

This is ready for review @nightwatchcyber

js/genform.js Outdated Show resolved Hide resolved
js/genform.js Outdated Show resolved Hide resolved
@rugk rugk mentioned this pull request Jul 13, 2021
@nightwatchcyber nightwatchcyber merged commit b9649f6 into securitytxt:master Jul 15, 2021
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.

3 participants