Closed ee92 closed 2 years ago
Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.
Can you check this issue @SAP/ui5-webcomponents-topic-b it is reproducible although the sample is with the react wrappers. I think it won't take much to re-create it with pure ui5-webcomps.
Here is a demonstration of the issue with pure ui5-webcomponents https://codesandbox.io/s/ui5-webcomponents-forked-l8e24?file=/src/index.js
The breaking change seems to have been introduced between 1.0.0-rc.15 and 1.0.0-rc.16 The linked example works as expected when choosing @ui5/webcomponents 1.0.0-rc.15
The issue seems to be caused by this line: https://github.com/SAP/ui5-webcomponents/blob/master/packages/main/src/DatePicker.js#L549 (Error value state being changed to None)
Is there any update on a fix?
Hello @ee92 ,
Sorry for the late response!
Have you tried to prevent the default behaviour of the control? The change and input events of the DatePicker are preventable, this will prevent the change of the value and the internal verification, so you will have the full control over the value change and the value state change. You will still receive the value in the event and that the value is changed, but if you prevent it, the value and the value state won't be touched by the control itself.
Can you please verify if this will fix your issue?
Best Regards, Tsanislav
@tsanislavgatev the issue is not fixed by using preventDefault
on the event. This line still runs and causes the valueState to be changed to "None" https://github.com/SAP/ui5-webcomponents/blob/master/packages/main/src/DatePicker.js#L558
@ee92 Hello, I've made a quick recording of both cases.
The method you are refering to is called after we check if the event is prevented. https://github.com/SAP/ui5-webcomponents/blob/532d676c367832542ba469c45643f686a03a0168/packages/main/src/DatePicker.js#L540
And then called here: https://github.com/SAP/ui5-webcomponents/blob/532d676c367832542ba469c45643f686a03a0168/packages/main/src/DatePicker.js#L549
Can you please check the behaviour again? And if still failing, to provide an example again so I can investigate.
Best Regards, Tsanislav
@tsanislavgatev
This is true for DatePicker, but not for DateTimePicker. I updated the ticket description with a new sandbox that uses DateTimePicker instead.
Just by looking at the code you can see this line runs unconditionally: https://github.com/SAP/ui5-webcomponents/blob/3236d56bee43eb8d1e31bb3a59499226889e95bf/packages/main/src/DateTimePicker.js#L373
We had no issue with this previous to upgrading to 1.x.x so hoping that the solution does not require preventing the event.
Thanks
Hello,
The change that introduced the secondary check is to improve the checks that the component provides. The control itself provides a bahaviour with predefined validations of dates, ranges, formats of date/time. It comes by default with the control, that's why you receive this removing of the value state. Because of this we've introduced the preventable behaviour, for the developers who don't need our checks, to give them the opportunity to implement their validation and value setting. That's why we are talking about preventing the default behaviour and why we decided to provide a full control option.
Best Regards, Tsanislav
Bug Description
The datetime picker reverts "Error" value-state back to "None" when a valid date is selected. This only happens for "Error" and not for "Warning", "Information", or "Success".
Expected Behavior
Expect to be able to set the valueState to "Error" programmatically based on custom validation, without the component reverting it to "None" for what it considers is a valid date.
Steps to Reproduce
Steps to reproduce the behavior:
Context
Priority
Stakeholder Info (if applicable)
Thanks for taking a look!