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

fix: revert input on overlay close by escape #7293

Merged

Conversation

ugur-vaadin
Copy link
Contributor

@ugur-vaadin ugur-vaadin commented Apr 2, 2024

Description

Currently, when

  1. the date picker has a value
  2. an invalid value is entered
  3. date picker overlay is closed using escape

the input is not reverted and the date picker is validated using the unparsable input.

This PR reverts the input value to the last selected date if the overlay is closed using escape.

!!! This fix was tested with the Flow counterpart. However, if any regressions occur regarding the validation chain, this PR can be the culprit. !!!

Fixes #4354

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/overview
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

return date.toISOString().split('T')[0];
}

const TODAY_DATE = formatDateISO(new Date());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are not actually related to the issue. This formatting does not take time zones into consideration. This leads to tests failing when time zone is not GMT.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could extract this change into separate PR marked as test: and maybe backport to 24.3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted the test PR and reverted the changes in this one.

@@ -1,19 +1,12 @@
import { expect } from '@esm-bundle/chai';
import { aTimeout, fixtureSync, nextRender, outsideClick, tap } from '@vaadin/testing-helpers';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import.

@ugur-vaadin ugur-vaadin changed the title fix: revert input and do not commit on overlay escape fix: revert input and before commit on overlay escape Apr 3, 2024
@ugur-vaadin ugur-vaadin changed the title fix: revert input and before commit on overlay escape fix: revert input before commit on overlay escape Apr 3, 2024
@ugur-vaadin ugur-vaadin changed the title fix: revert input before commit on overlay escape fix: revert input on overlay close by escape Apr 4, 2024
@ugur-vaadin ugur-vaadin marked this pull request as ready for review April 4, 2024 06:56
Copy link

sonarqubecloud bot commented Apr 8, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ugur-vaadin ugur-vaadin removed the request for review from DiegoCardoso April 8, 2024 13:24
@ugur-vaadin ugur-vaadin merged commit 9e62c93 into main Apr 8, 2024
9 checks passed
@ugur-vaadin ugur-vaadin deleted the fix-revert-input-and-do-not-commit-on-overlay-escape branch April 8, 2024 13:24
vaadin-bot pushed a commit that referenced this pull request Apr 8, 2024
* fix: revert input and do not commit on overlay escape

* refactor: commit the reverted date so that the validation cycle runs

* test: revert test update for unparsable value change event

* test: revert test formatter changes
web-padawan pushed a commit that referenced this pull request Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[date-picker] Invalid input does not clear on esc if value is selected
3 participants