final-form / react-final-form-html5-validation

A swap-in replacement for 🏁 React Final Form's <Field> component to provide HTML5 Validation
MIT License
56 stars 8 forks source link

email validation #26

Open dexterns88 opened 4 years ago

dexterns88 commented 4 years ago

What is the current behavior?

Valid input when enter: abc.def@mail

What is the expected behavior?

Show error on: abc.def@mail - invalid email

Other information

you can check issue here https://codesandbox.io/s/14r018yjp4 with type mail like abc.def@mail into email field and no error

rishabh-ink commented 4 years ago

I don’t think this is an issue because abc.def@mail matches the pattern of a valid email address. As another example, root@localhost is a perfectly valid email address.

For more info, see Why does HTML5 form-validation allow emails without a dot?, where one of the answers mentions:

Because bar is a valid hostname, which makes foo@bar a valid email address. Chrome is not going to check for you whether the address or host are actually in use, only whether the semantics are correct. See http://en.wikipedia.org/wiki/Email_address#Domain_part for examples of valid email addresses.

Or How does HTML5 input type email works without top level domain name, where one of the answers mentions:

Because a@b is a valid email address (eg localhost is a valid domain). See http://en.wikipedia.org/wiki/Email_address#Examples