-
Notifications
You must be signed in to change notification settings - Fork 357
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
Bug - DatePicker - onBlur is not called on all field changes #8779
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue was reported in v4, from what I understand this was only fixed in v5. Can the fix be backported to v4? |
Updated the sandbox above to version @patternfly/[email protected] that should have this fixed but it is still not working as expected. onBlur is not being triggered when we click on a date in the calendar popover. Will you reopen this issue or should I create a new one? |
@hugoribeiromsglife currently the patternfly-react/packages/react-core/src/components/DatePicker/DatePicker.tsx Lines 193 to 200 in 40075dc
|
Describe the problem
onBlur
is only called if a value is entered in the text input. It is important to fire the onBlur event because this also triggers the validation (we can’t catch an empty field that is required) and updates any error messages.How do you reproduce the problem?
Tab
(triggersonBlur
)Tab
againTab
Expected behavior
It is expected that
onBlur
(and any other validator) will be called whenever a value is changed, either by the calendar or by inputting the text.Is this issue blocking you?
Our workaround is to use a copy of the
DatePicker
component with the following changes:• For the change text onBlur is to remove the
if(pristine)
check.• For the calendar is change the
<Popover>
’s props to includeonHide={() => onInputBlur(null)}
.Screenshots
N/A
What is your environment?
What is your product and what release date are you targeting?
PMWeb, an insurance actuator product. We do continuous releases.
Any other information?
I believe this issue is a result of the fix for bug #6822 (released in v4.192.4). It looks to me like the value of
pristine
was changed to mean "is empty" from "is unchanged". The ability to change from a valid date to an empty date without it displaying an error is a valid use case. However, that doesn’t mean we can skip the validation triggered by onBlur. It is also a valid use case to not allow an empty date field.The text was updated successfully, but these errors were encountered: