-
Notifications
You must be signed in to change notification settings - Fork 86
feat!: datetimepicker validation improvements #8986
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
feat!: datetimepicker validation improvements #8986
Conversation
packages/date-time-picker/test/individual-picker-update-helpers.js
Outdated
Show resolved
Hide resolved
I think that is my misunderstanding rather than an implementation error. My understanding was that the validation should not run when the component is blurred with no change to the input even if it is required. |
Yeah, there is a difference in component behavior: web components should validate on blur, whereas flow components should not. |
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
I guess this place needs to be fixed too, as otherwise required validation doesn't occur when the overlay is closed by clicking outside – a case that is also treated as blur in other components such as date-picker, even though focus is restored afterwards. |
Fixed and added tests. |
if (isOutsideClick) { | ||
this.__outsideClickInProgress = true; | ||
|
||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use queueMicrotask
here to limit more preciesely how long this flag stays true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that queueMicrotask
does not provide enough of a duration for the flag to stay true.
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
Co-authored-by: Sergey Vinogradov <[email protected]>
This reverts commit 927bb35.
}); | ||
|
||
it('should commit as unparsable on Enter', async () => { | ||
await enterParsableInput(picker); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this to beforeEach
await enterParsableInput(picker); | |
await enterParsableInput(picker); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
}); | ||
|
||
it('should commit as unparsable on Enter', async () => { | ||
await enterUnparsableInput(picker); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this to beforeEach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
|
This ticket/PR has been released with Vaadin 24.8.0.rc2 and is also targeting the upcoming stable 24.8.0 version. |
Description
unparsable-change
event for the web component.min
and/ormax
DateTimePicker
is still being edited, the validation behaves the same for Enter, outside click, and blur.Based on the prototype implementation.
Part of #6697.
Type of change
Checklist