css-anchor-positioning icon indicating copy to clipboard operation
css-anchor-positioning copied to clipboard

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

Open herrKlein opened this issue 1 year ago • 4 comments

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

herrKlein avatar Apr 22 '24 09:04 herrKlein

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?

jgerigmeyer avatar Apr 22 '24 18:04 jgerigmeyer

I've confirmed it on my personal project, it seems this polyfill will not cover the custom elements(with using shadow dom), all the polyfills works as expected on light dom. If you use custom elements without shadow dom, I think it should also work.

haoliangwu avatar Dec 07 '24 09:12 haoliangwu