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 258 forks source link

afterClose event is bubbling to its container when it should not #7637

Closed ybesnehard closed 11 months ago

ybesnehard commented 11 months ago

Bug Description

When you are creating a Dialog with a Menu inside it. The afterClose event of the Menu's Popup is also fired on the containing Dialog. It should not be the case.

In our product (SAP Build Process Automation) specific usecase we remove the dialog from the DOM on afterClose event when dialog are dynamically added in the DOM at opening. So on the afterClose of the Menu that is opened in the dialog, the dialog itself is destroyed from the DOM.

This of course could be a more generic event bubbling issue that create this

Affected Component

Eventing / Dialog / Menu

Expected Behaviour

afterClose event should not bubble from the Menu to its Dialog container

Isolated Example

https://codesandbox.io/s/ui5-webcomponents-forked-plkf4s?file=/src/index.js

Steps to Reproduce

  1. Open the code sandbox
  2. Click on the Open Dialog Button
  3. Click on Open Menu Button
  4. Select one item of the Menu
  5. The afterClose event of the Dialog is triggered (alert display message) when it should not.

Log Output, Stack Trace or Screenshots

No response

Priority

High

UI5 Web Components Version

1.17.2

Browser

Chrome

Operating System

Windows

Additional Context

No response

Organization

SAP

Declaration

elenastoyanovaa commented 11 months ago

Hello @SAP/ui5-webcomponents-topic-b ,

The issue is reproducible with the sample provided. afterClose event bubbles for the Menu components.

Kind Regards, Elena

ybesnehard commented 10 months ago

The issue is still happing with SelectMenu :( https://codesandbox.io/s/ui5-webcomponents-forked-ykvz69?file=/index.html

ilhan007 commented 10 months ago

The issue is still happing with SelectMenu :( https://codesandbox.io/s/ui5-webcomponents-forked-ykvz69?file=/index.html

@ybesnehard the SelectMenu and Menu sound similar but they are completely different components. We will fix the issue in the SelectMenu, thanks for reporting.