dxc-technology / halstack-react

Library of components for building SPAs with React and Halstack Design System
https://developer.dxc.com/halstack/
Apache License 2.0
15 stars 14 forks source link

Dialog popups interaction fix #1817

Closed Mil4n0r closed 7 months ago

Mil4n0r commented 7 months ago

Checklist

Description Popups inside dialog were having unexpected behaviors when interacting with them. This has been fixed properly handling the keyboard events when wanting to close an inner popup and ensuring that Popups are being properly identified inside the DOM.

Closes #1515, #1809

Jialecl commented 7 months ago

I am not sure this is a good fix. Is this better than using the stopPropagation? This behavior needs to be added to the textInput and all future components that use the 'Escape' key.

Mil4n0r commented 7 months ago

I am not sure this is a good fix. Is this better than using the stopPropagation? This behavior needs to be added to the textInput and all future components that use the 'Escape' key.

As Iván pointed out here, it is advisable to avoid using stopPropagation due to the potential risks associated with disabling event bubbling. In our case, while we are altering the way popup elements interact, we are careful not to prevent bubbling. Thus, we should not encounter dead zones within the UI, even with multiple nested menus.

I acknowledge that both this workaround and the use of stopPropagation come with the drawback that these lines must be added to all components that require the usage of events with the Escape key (both existing and new ones). I will continue exploring alternative approaches to address this issue. However, right now, I am unable to identify a more suitable solution.

Mil4n0r commented 7 months ago

It has been decided to split this PR in 2, one that fixes popups not working inside Dialog and the other one (which is still pending for approval from the rest of the members) will fix the interaction with the Escape key.