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

IntegerField / BigDecimalField .clear sets state to invalid #5462

Closed
h-huss opened this issue Sep 13, 2023 · 1 comment · Fixed by #5579
Closed

IntegerField / BigDecimalField .clear sets state to invalid #5462

h-huss opened this issue Sep 13, 2023 · 1 comment · Fixed by #5579

Comments

@h-huss
Copy link

h-huss commented Sep 13, 2023

Description

When calling IntegerField.clear or BigDecimalField.clear, the component is marked as invalid

This seems to be related to #4833 and vaadin/web-components#5410

Expected outcome

The component should remain valid, as null is an acceptable value

Minimal reproducible example

@Route("test")
public class TestView extends VerticalLayout {
  public TestView() {
    DatePicker datePicker = new DatePicker();
    IntegerField intField = new IntegerField();
    DateTimePicker dtp = new DateTimePicker();
    BigDecimalField bdf = new BigDecimalField();
    Button clear = new Button("Clear", event -> {
      datePicker.clear(); // Clears OK
      intField.clear(); // Invalid
      dtp.clear(); // Clears OK
      bdf.clear(); // Invalid
    });
    add(datePicker, intField, dtp, bdf, clear);
  }
}

Steps to reproduce

  1. Fill the fields
  2. Click clear
  3. IntegerField and BigDecimalField will become invalid

Environment

Vaadin version(s): 24.1.9
OS: Windows

Browsers

Issue is not browser related

@h-huss h-huss changed the title IntegerField / BigDecimalField .clear sets state to Invalid IntegerField / BigDecimalField .clear sets state to invalid Sep 13, 2023
@h-huss
Copy link
Author

h-huss commented Sep 13, 2023

Workaround is the same as in #4833: Call setValue(null) twice.

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

Successfully merging a pull request may close this issue.

3 participants