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.47k stars 254 forks source link

[SF][A11y][ui5-dialog][ui5-popover] All dialogs and popovers close on press of esc key #8652

Closed bonnieso closed 4 weeks ago

bonnieso commented 3 months ago

Bug Description

Opening this new ticket since the this issue still persists.

Reference: https://github.com/SAP/ui5-webcomponents/issues/6884

Bug Description

When multiple dialogs or popovers are open on a given page, pressing the "escape" key closes all of the dialogs and popovers. This happens when different cores of ui5-webcomponents exist on a page and different cores control different dialogs and popovers. So when then "escape" key is pressed, this line https://github.com/SAP/ui5-webcomponents/blob/63986f557a78ac14674d2e618ed40967ed5a1102/packages/main/src/popup-utils/OpenedPopupsRegistry.ts#L48 executes for all of the open dialogs and popovers because the open components are being tracked by this variable https://github.com/SAP/ui5-webcomponents/blob/63986f557a78ac14674d2e618ed40967ed5a1102/packages/main/src/popup-utils/OpenedPopupsRegistry.ts#L9 and the dialogs loaded from different cores aren't aware of each other. In order to solve this issue, we are proposing to add a registry that is shared across different cores.

Affected Component

ui5-dialog

Expected Behaviour

On press of the "escape" key, only the component (ui5-dialog or ui5-popover) that is in focus closes.

Isolated Example

Go to https://codesandbox.io/p/sandbox/ui5-webcomponents-forked-c867m7

Steps to Reproduce

  1. Go to https://codesandbox.io/p/sandbox/ui5-webcomponents-forked-c867m7
  2. Click "Open Dialog"
  3. Click "Open Inner Dialog"
  4. Press "Esc" key
  5. Observe that both dialogs close when only the inner one should close.

Log Output, Stack Trace or Screenshots

No response

Priority

Medium

UI5 Web Components Version

1.23.0

Browser

Chrome, Edge, Firefox, Safari

Operating System

No response

Additional Context

No response

Organization

SAP SuccessFactors

Declaration

dobrinyonkov commented 3 months ago

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

this is regarding an issue involving multiple popups on a page with several ui5-webcomponents versions, following up on https://github.com/SAP/ui5-webcomponents/issues/6884. It appears there still might be some problems. Specifically, when closing the first dialog with the ESC key, the second one also closes unexpectedly.

Could you please investigate this?

Kind Regards, Dobrin

dimovpetar commented 1 month ago

Hello @bonnieso ,

Please elaborate on which version is the second runtime? The fix needs to be part of all runtimes, in order to work. In fact, there seems to be only 1 runtime in the given sample, but maybe this is just a sample issue? Please update and retest.

Best regards, Petar

github-actions[bot] commented 1 month ago

Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!

github-actions[bot] commented 4 weeks ago

Hello, everyone! The issue has been inactive for 28 days, so I am closing the issue.