Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align triggering validation on property changes #4196

Open
13 tasks
vursen opened this issue Jul 14, 2022 · 2 comments
Open
13 tasks

Align triggering validation on property changes #4196

vursen opened this issue Jul 14, 2022 · 2 comments
Assignees
Labels
refactor Internal improvement validation

Comments

@vursen
Copy link
Contributor

vursen commented Jul 14, 2022

Motivation

Validation is not triggered consistently on constraint and value property changes across field components. To illustrate the issue, look at how different components handle validation on change of different properties:

TimePicker

Property Validation on change
value no
min no
max no
pattern only if already invalid and pattern is defined
required no

DatePicker

Property Validation on change
value only if value is provided
min only if value is provided
max only if value is provided
pattern only if already invalid and pattern is defined
required no

Select

Property Validation on change
value always
required no

NumberField

Property Validation on change
value only if already invalid
step only if already invalid and step is defined
min only if already invalid and min is defined
max only if already invalid and max is defined
required only if already invalid and required is defined (= true)

So, as you can see, things are quite inconsistent at the moment. One of the reasons is that not all the components are currently using InputConstraintsMixin.

Proposal

  • Validate on value property change when at least one constraint is defined.
  • Validate on constraint property change when a non-empty value is provided (extracted to #4371).

Also, prefer using InputConstraintsMixin wherever possible.

Components

  • TextField
  • EmailField
  • PasswordField
  • Select
  • ComboBox / MultiSelectComboBox
  • DatePicker
  • TimePicker
  • DateTimePicker
  • IntegerField
  • NumberField
  • CheckboxGroup
  • RadioGroup
  • TextArea
@vursen vursen added requires new major This would be a breaking change refactor Internal improvement labels Jul 14, 2022
@vursen
Copy link
Contributor Author

vursen commented Jul 14, 2022

Related to #4170 in terms of both affecting the validation logic in InputConstraintsMixin.

@vursen
Copy link
Contributor Author

vursen commented Jul 19, 2022

A similar issue for Flow components: vaadin/flow-components#2370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Internal improvement validation
Projects
None yet
Development

No branches or pull requests

2 participants