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

Ensure no initial validation when the field has an initial value and invalid #4150

Closed
13 tasks done
vursen opened this issue Jul 8, 2022 · 0 comments
Closed
13 tasks done

Comments

@vursen
Copy link
Contributor

vursen commented Jul 8, 2022

Motivation

The recently introduced validated event has revealed that there is an initial validation that happens when the field has an initial value and is initially marked as invalid:

const textField = document.createElement('vaadin-text-field');
textField.value = 'Initial Value';
textField.invalid = true;
textField.addEventListener('validated', () => {
  console.warn('The text field was validated!'); // You'll see this warning.
});
document.appendChild(textField);

The initial validation is problematic because it may result in an invalid state reset on the Flow side, see vaadin/flow-components#3429 (comment) for a more detailed case.

A follow-up to #4081.

Part of vaadin/platform#3066

Solution

Ensure no initial validation when the field has an initial value and invalid. The validation should only happen on some interaction with the field.

Components

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

No branches or pull requests

2 participants