logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.77k stars 1.26k forks source link

Default Tag for Observers and Providers #2902

Closed ma-jahn closed 4 years ago

ma-jahn commented 4 years ago

Versions

Describe the bug We are using vee-validate for quite a while and recently migrated to v3. Thank you for this lib 🚀 Maybe i'm mistaken but i think two default settings should be changed.

Both ValidationObserver and ValidationProvider are using <span> as default tag name and therefore render, if not specified otherwise, their slots within a <span></span>.

This will most likely result in invalid HTML since spans are in-line elements and should not contain block level elements.

Is this behaviour intentional?

We are using ValidationObserver to wrap forms and Providers to wrap input components within these forms. Since there is no way to change the tags globally each usage needs to set the components tag to div.

I hope the above makes sense.

logaretm commented 4 years ago

It does make sense, however changing that now would break some people's tests. Now both components have always been intended to be "renderless" but because Vue 2 doesn't support multi-root elements. The span is borrowed from the transition-group component doing the same.

This is no longer applicable in future releases with v4 and Vue 3, thanks for bringing this up and I hope my answer is satisfactory.