Clay: ClayDropdown.Menu panel misalignment within a ClayModal when the modal body is scrollable

Created on 19 Nov 2020  路  2Comments  路  Source: liferay/clay

  • [X] I have searched the issues of this repository and believe that this is not a duplicate.

Is there an example you can provide via codesandbox.com?

https://codesandbox.io/s/peaceful-bhabha-lfv6d?file=/src/index.js

What are the steps to reproduce?

If you use ClayModal.Body as scrollable and use a ClayDropdown.Menu component within, the dropdown panel will not be realigned to the trigger element.

Kapture 2020-11-19 at 14 42 24

What is the expected result?

Dropdown panel still aligned with the trigger element.

Using observeRect from '@reach/observe-rect' may solve it. As the example below:

https://github.com/liferay-frontend/liferay-portal/pull/430/files#diff-298ea5905081aa95c932d1681a7bcf60538269e3e9a96379a504259364432271R99-R101

Environment

| Tech | Version |
| ----- | ------- |
| Clay | v3.8.0 |
| React | XXXX |

3.x clay-components bug

Most helpful comment

Using observeRect from '@reach/observe-rect' may solve it.

@reach/observe-rect is only a few lines of code, so if we wanted to avoid the liability of pulling in another third-party dependency (we have been burned so many times in the past) we could probably implement equivalent functionality pretty trivially.

All 2 comments

Using observeRect from '@reach/observe-rect' may solve it.

@reach/observe-rect is only a few lines of code, so if we wanted to avoid the liability of pulling in another third-party dependency (we have been burned so many times in the past) we could probably implement equivalent functionality pretty trivially.

This issue has been merged and will be released in DXP at https://issues.liferay.com/browse/LPS-126700

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bryceosterhaus picture bryceosterhaus  路  5Comments

bicienzu picture bicienzu  路  3Comments

drakonux picture drakonux  路  3Comments

drakonux picture drakonux  路  4Comments

brunofarache picture brunofarache  路  5Comments