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

[date-picker] The value property is not cleared when committing invalid input and autoOpenDisabled #5066

Closed
vursen opened this issue Nov 22, 2022 · 1 comment · Fixed by #5076
Labels

Comments

@vursen
Copy link
Contributor

vursen commented Nov 22, 2022

Description

A finding from vaadin/flow-components#1158 (comment)

Trying to commit an invalid input when autoOpenDisabled = true results in the value property holding the previous value, unlike autoOpenDisabled = false where the value property is cleared in that case.

Screen.Recording.2022-11-22.at.17.13.22.mov

Related to vaadin/platform#3066

Expected outcome

The value property should be cleared when trying to commit an invalid input, the same way it currently works when autoOpenDisabled = false

Minimal reproducible example

<vaadin-date-picker auto-open-disabled></vaadin-date-picker>

<script type="module">
  import '@vaadin/date-picker';

  const datePicker = document.querySelector('vaadin-date-picker');
  datePicker.addEventListener('value-changed', (e) => {
    console.log('Value: ', e.detail.value);
  });
</script>

Steps to reproduce

  1. Add the above example on an HTML page
  2. Enter 1/1/2022 and press Enter to commit the value
  3. Enter foobar and press Enter

Environment

Vaadin version(s): Latest
OS: Mac OS

Browsers

Issue is not browser related

@vursen vursen added bug Something isn't working vaadin-date-picker labels Nov 22, 2022
@vursen vursen changed the title [date-picker] Committing an invalid input doesn't reset the component's value when autoOpenDisabled [date-picker] The value property isn't reset when committing an invalid input and autoOpenDisabled Nov 22, 2022
@vursen vursen changed the title [date-picker] The value property isn't reset when committing an invalid input and autoOpenDisabled [date-picker] The value property is not reset when committing an invalid input and autoOpenDisabled Nov 22, 2022
@sissbruecker
Copy link
Contributor

Note that the same issue also occurs when blurring the field.

Here's a naive attempt at fixing the issue: 057e3ee. Given how many conditions this removes, I wonder if we are missing some tests.

@vursen vursen changed the title [date-picker] The value property is not reset when committing an invalid input and autoOpenDisabled [date-picker] The value property is not cleared when committing invalid input and autoOpenDisabled Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants