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

Fix scroll issue in Dialog component #1781

Closed GomezIvann closed 8 months ago

GomezIvann commented 8 months ago

Checklist (Check off all the items before submitting)

Description Fixed the auto-scroll problem when the focus was moving within the dialog. The FocusLock wraps its child component between two colliding divs that prevent the focus from moving out of it. The scroll when tabbing is caused by those divs that gain the focus momentarily because they are placed at the very beginning of the page. As we are using a React Portal, they have been placed there, outside of the main flow, but not with the positioning of their children (in this case, the Dialog).

The fix is moving the FocusLock inside the main dialog container since we want to keep the focus locked in between the elements inside the Dialog, so it makes total sense.

Closes #1532