rentalutions / elements

Design kit for Avail rental management software
https://design.avail.co
10 stars 3 forks source link

Fix Popover position when parent ref is provided #199

Closed mzbeetnoff closed 2 years ago

mzbeetnoff commented 2 years ago

I found an issue that I don't think was previously discovered as I can't find an example in Avail where we consume a Popover component and pass in a parentRef.

When passing in a parentRef I've refactored the method around calculating the popovers position coordinate, I use the getBoundingClientRec method instead of using the scrollTop and scrollLeft properties which I found are normally 0.

Passing in a parent ref is very useful for inserting the popover next to the button that triggered it for keyboard navigation. I have a feeling in the future when we aim to support keyboard navigation more generally, this property will be used more.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Updated | | :--- | :----- | :------ | :------ | | **avail-design-site** | ⬜️ Ignored ([Inspect](https://vercel.com/rent-avail/avail-design-site/CMHjPK4cFjcgRAChK2Zs6j4EevLA)) | | Aug 31, 2022 at 0:03AM (UTC) |
pkrawc commented 2 years ago

@mzbeetnoff Can you run yarn graduate from your branch and publish the results before we merge? I actually just removed my review approval until that's done. With that when we do merge, releases should happen automatically.

pkrawc commented 2 years ago

When you run graduate it'll likely update a bunch of packages because of a dependency on this one. Totally expected.