Skip to content

Auto-add mailto: prefix onchange - #83

Merged
nightwatchcyber merged 4 commits into
securitytxt:masterfrom
joker314:autofill-email
Jul 15, 2021
Merged

nightwatchcyber merged 4 commits into
securitytxt:masterfrom
joker314:autofill-email

Conversation

@joker314

Copy link
Copy Markdown
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')?

@rugk rugk left a comment

Copy link
Copy Markdown

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.

Comment thread js/genform.js Outdated
@joker314

Copy link
Copy Markdown
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

Comment thread js/genform.js Outdated
Comment thread js/genform.js Outdated
@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