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

[SF][a11y][popup-utils]: press ESC key will close multiple popups when the popups are created from different UI5 context #6705

Closed zhangliangyi closed 1 year ago

zhangliangyi commented 1 year ago

Bug Description

We have developed some widgets. The widgets have their separated bundle which contains ui5-webcomponents and react libraries. In some cases we need to reuse these widgets in different pages.

Let's imagine the following case: We open a ui5-dialog called DialogA in a page, and in the opened DialogA we need to import a widget described above. After the widget bundle loaded, we will have two UI5 contexts which are not accessible to each other.

Then when we open another ui5-dialog called DialogB from widget bundle and press ESC key, the keypress action will close both DialogA and DialogB.

The main reason of this behavior may be the popup registry is not shared across different UI5 context which is not like the processing of z-index.

And as a result of this, the event listener would be added to document for multiple times. https://github.com/SAP/ui5-webcomponents/blob/d37b319eb6f9b6ca27bd08a8a389595424f69f6e/packages/main/src/popup-utils/OpenedPopupsRegistry.ts#L22

Affected Component

ui5-dialog, ui5-popover

Expected Behaviour

The popup registry should be shared across multiple UI5 and OpenUI5 context, then the unexpected closure can be avoided.

Isolated Example

No response

Steps to Reproduce

1. 2. 3. ...

Log Output, Stack Trace or Screenshots

No response

Priority

Medium

UI5 Web Components Version

1.10.4

Browser

Edge

Operating System

No response

Additional Context

No response

Declaration

elenastoyanovaa commented 1 year ago

Hello @zhangliangyi ,

Can you please provide a test system, where we could test or an isolated sample in order to debug the issue?

Thanks in advance!

Kind Regards, Elena

zhangliangyi commented 1 year ago

I will prepare some testable example for this issue.

nnaydenow commented 1 year ago

Hi @zhangliangyi,

I'm closing the incident since it seems to be the same with: #6884 and there is more information about the issue. Also there is reproducible example so no need to prepare one.

Regards, Nayden

zhangliangyi commented 1 year ago

That's great. Thanks @nnaydenow .