SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.53k stars 265 forks source link

[Date Picker]: Open DatePicker from different component not working #10063

Open sebastian-kraemer opened 6 days ago

sebastian-kraemer commented 6 days ago

Describe the bug

Since openPicker and closePicker are no longer available in v2, opening with a state variable only works once when closing the DatePicker Popover with ESC or by clicking outside the Popover. There is no callback when the Popover is closed if not selecting a value.

Isolated Example

https://stackblitz.com/edit/github-3vdyel?file=package.json

Reproduction steps

  1. Click Button => DatePicker Popover opened
  2. Click outside of Popover or hit ESC => Popover closes
  3. Click Button => DatePicker Popover is not opening anymore because open is still true

Expected Behaviour

Event is triggered when Popover was closed to update local state variable.

Screenshots or Videos

No response

UI5 Web Components for React Version

2.3.0

UI5 Web Components Version

2.3.0

Browser

Edge

Operating System

Windows

Additional Context

No response

Relevant log output

No response

Organization

No response

Declaration

Lukas742 commented 6 days ago

Hi @sebastian-kraemer

Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.

As a workaround, you can set the open property directly on the element: https://stackblitz.com/edit/github-3vdyel-stt7yh?file=src%2FApp.tsx


Hi Colleagues, there is currently no way to register to internal open state changes of the DatePicker component. This is problematic when using React, as when using a React state to control the open value, the state is never reset when internally the open property changes and therefore React omits updates as the state has the same value as before:

https://stackblitz.com/edit/github-3vdyel?file=src%2FApp.tsx

Exposing the close event of the Popover would allow setting the open state accordingly.

Valkanister commented 4 days ago

Hello @SAP/ui5-webcomponents-topic-b, Please take a look at this issue regarding opening a DatePicker and the "open" state indication.

Kind regards, 

GV

SAPUI5 | SAP Development Support