oddbird / css-anchor-positioning

Polyfill for CSS Anchor Positioning
https://anchor-polyfill.netlify.app/
BSD 3-Clause "New" or "Revised" License
225 stars 5 forks source link

Can I load this in a custom-element, so it can access shadow-dom? #170

Open herrKlein opened 2 months ago

herrKlein commented 2 months ago

Hi, really nice polyfill.

I would like the example which keeps the container in the viewport. I have 2 questions. Does it work with shadowdom. I would like to use it for a custom dropdown component where the popup has to stay inside the window.

Second question is, I see the example constantly updating when it overlaps the border of the scrollable content. Wouldn't that make it slow. Is that a bug?

Screenshot 2024-04-22 at 11 30 53

jgerigmeyer commented 2 months ago

Does it work with shadowdom. I would like to use it for a custom dropdown component where the popup has to stay inside the window.

That's a great question, and my answer is honestly "I'm not sure." We paused development on this polyfill to allow the spec to stabilize (see comment here), and I don't think we've tested with custom components yet. If you have time to test that out, please report back!

Second question is, I see the example constantly updating when it overlaps the border of the scrollable content. Wouldn't that make it slow. Is that a bug?

Yes, that certainly looks like a bug to me. Would you be willing to open a new issue?