kirby icon indicating copy to clipboard operation
kirby copied to clipboard

Goodbye `vuelidate`

Open distantnative opened this issue 2 years ago • 6 comments

Status

Todo

  • [ ] Add native validity alongside vuelidate as much as possible
    • [ ] https://github.com/getkirby/kirby/pull/6253
    • [ ] https://github.com/getkirby/kirby/pull/6254
  • [ ] Add lab examples for each input/field for each validation

This PR …

Enhancements

  • Relying front-end validation on native HTML invalid states
  • New k-array-input for validating inputs with multiple values

Refactoring

  • Removed vuelidate library (-22.5 KB for the vendor bundle)

Breaking changes

  • k-form and k-fieldset as well as many fields and inputs don't emit an invalid event anymore. Use native HTML invalid state of elements instead.

distantnative avatar Dec 29 '23 20:12 distantnative

@bastianallgeier Could I pick your brain

Consider if to add alternative to ArrayInput e.g. for ObjectField (works with ArrayInput, but naming wise a bit confusing)

How do you feel about the ArrayInput after a while now? Still good for checkboxes etc.? And what about e.g. ObjectField?

distantnative avatar Jan 25 '24 14:01 distantnative

@distantnative I was thinking about this. How would we handle this if it was plain html & js and what is the most accessible solution? Maybe we are already trying to make it too smart again?

bastianallgeier avatar Jan 26 '24 10:01 bastianallgeier

@bastianallgeier could we create a similar thing to ArrayInput with a mixin that provides most of the validate methods etc. and relies on a computed prop input() e.g. that points to the HTMLElement of the specific component to which the validity etc. should be applied to?

distantnative avatar Jan 26 '24 17:01 distantnative

TBH whenever I come back to this, I think that we need to break it down like we did with a couple monster tasks during v4. It is just too overwhelming in a single PR.

bastianallgeier avatar Feb 07 '24 14:02 bastianallgeier

@bastianallgeier That's what I've already been doing with many recent PRs. They all came from this. For me this PR is a good progress bar to see what we still can isolate etc.

It will always be a big PR still in the end. We have so many inputs and fields and some parts can only be done at once.

The biggest showstopper here IMO is that we don't know how to pursue with ArrayInput.

The rest then is mainly just double checking if all validations really exist and add lab examples where missing.

distantnative avatar Feb 07 '24 14:02 distantnative

Ok, that makes sense. I agree that the array input is super weird. Maybe we need to tackle that separately with a concept first and work on it together.

bastianallgeier avatar Feb 07 '24 16:02 bastianallgeier

@bastianallgeier I think the crucial part here is to decide if the use of novalidate here is correct

distantnative avatar Mar 11 '24 16:03 distantnative