Availity / availity-reactstrap-validation

Easy to use React validation components compatible for reactstrap.
https://availity.github.io/availity-reactstrap-validation/
MIT License
191 stars 71 forks source link

Migrating over to Availity-React #119

Closed GoPro16 closed 5 years ago

GoPro16 commented 5 years ago

We are considering merging the components here into the availity-react repo so we can have everything managed in one place. We can do a run through of all the open issues here and consider any breaking changes for the v1.0.0 on availity-react.

@TheSharpieOne I wanted to get your thoughts on this because we also have considered re-writing the validation using Formik once v2 gets published with hooks.

There are obviously trade offs to both and at its current state its not worth re-writing with Formik until its stable with v2.

TheSharpieOne commented 5 years ago

rewriting using Formik was one of the things considered. Formik has some drawbacks. FastField fixed one of them; kinda. Validation schema is another.

This library supported an already existing validation schema within Availity. Formik only supports Yup for validation schema. Another thing this library helps with is A11y. It will take a validation schema and apply the correct attributes (for things like required, min, max, email, date, etc). Yup doesn't let you determine what validations are configured in the schema (you can't determine whether a field is required or what validations are being applied based on the schema).

Not sure if any of that is going to change in Formik v2.

I also looked at Final Form React, and it looked very nice and probably fit in a bit better.

The main point of this library was to get the Availity branded look and feel (along with A11y) without making the developer have to do much work for 90% of the forms. By that I mean: Developers wouldn't need to worry about invalid fields, validations, and error messages.

Obvious a lot of that can be abstracted into the components which would become availity-reactstrap-validation no matter which library it is designed to work with.

robmcguinness commented 5 years ago

Formik discussion about a11y and required fields:

TheSharpieOne commented 5 years ago

required is just one example. If any of the HTML5 validations are used (such as min and max on number/date types, minlength, maxlength, pattern on text types, etc.), they should appear as attributes. It informs the screen readers what values are allowed.

robmcguinness commented 5 years ago

Agreed. Just noting for future reference in case the Formik discussion comes up again. Trying to minimize the amount of API footprint we maintain but you have made convincing arguments if favor of accessibility.

Closing since this lib can be useful as standalone so I think moving to availity-react will be confusing. Probably going to upgrade the dev tools in future PR to keep things consistent.