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.5k stars 260 forks source link

ResponsivePopover should use useViewportRange instead of device or it causes bugs #5026

Open C3ntraX opened 2 years ago

C3ntraX commented 2 years ago

Is your feature request related to a problem? Please describe. Resizing the browser should automatically turn the ResponsivePopover in a Dialog, or it causes several bugs: If the screen size changes the reference button for the popover could be wrapped in an overflow button.

If you click in the shellbar on the overflow and than the Notifications button, you see the popover for the Notifications button disappears. If you click on the opened popover the popover itself disappears too, because the button reference is not there anymore. In a toolbar with an overflowbutton, the button does not disappear.

Describe the solution you'd like Responsive Popover should use the hook useViewportRange instead of a static function. This is best practice for react and should be used. For my understanding of react, this should be happen everywhere, but this is the component it causes several problems.

Steps to reproduce

  1. Rezize the window, until the the overflow button appears in the shell bar
  2. Click on the button "Notifications"
  3. You see that the overflow button disappers
  4. Click on whitespace in the popover and the popover should dissappear

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context https://codesandbox.io/s/sad-archimedes-3wvwws?file=/src/App.js)](https://codesandbox.io/s/sad-archimedes-3wvwws?file=/src/App.js

MarcusNotheis commented 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.

nnaydenow commented 2 years ago

Hello colleagues,

Seems that the button references is not correctly provided when they are added in menuItems slot of ui5-shellbar. If the button overflow correct reference has to be overflow button or the list item if the overflow popover is not closed.

Regards, Nayden

C3ntraX commented 2 years ago

Hello @nnaydenow,

yes this is a bug I described as well. Can you add a bug label or should I write this issue again?

nnaydenow commented 2 years ago

Hi @C3ntraX,

I already added it. We will process it ASAP.

Regards, Nayden

nnaydenow commented 2 years ago

Hi @C3ntraX,

You can prevent event from its default behaviour which is to close the popover and then the popover opener will be the list item from overflow. We are looking for another solution.

Regards, Nayden