-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: CSS container queries break Popover positioning #3356
Comments
When searching around the internals, I did find this reference to the components/src/internal/utils/dom.ts Lines 8 to 16 in 7ff86dc
Which is used here to determine the popover's boundary : components/src/popover/use-popover-position.ts Lines 91 to 97 in 7ff86dc
Looking at the git blame, the change to treat If I manually edit my local copy of cloudscape in my components/src/internal/utils/dom.ts Line 13 in 7ff86dc
|
Hey @bmv437 |
Thanks for opening the bug report - I can reproduce this in Chrome and Firefox (but not Safari). The original PR was necessary because a query container is supposed to create a new containing block context and affect fixed positioning for child components. But it looks like this behavior was silently changed at some point (w3c/csswg-drafts#10544) after the PR was released, and updated only in Chrome and Firefox. So it looks like we'll have to do some browser/CSS support checks before applying this logic. |
Thanks for looking into it. Very cool find around the behavior changing in Chrome/Firefox but the MDN docs not reflecting that. I did some additional research into similar popover implementations, and found this: Internally, they have a very similar And they also have overflow element detection: Which seems similar to the components/src/popover/use-popover-position.ts Lines 253 to 256 in 673f781
|
Hey @bmv437, Thanks for your research! Our team is still working on the mitigation. Meanwhile, you might be able to use the workaround by setting the |
Browser
Chrome
Package version
latest from live
React version
v18.3.1
Description
When a Popover component is rendered as a descendant of an element that uses CSS container queries with the
container-type
property set tosize
orinline-size
, the position of the popover is no longer correct.Here's a video of the behavior I'm seeing:
Screen.Recording.2025-03-18.at.11.40.40.AM.mov
I've included a reproduction as well.
Source code
No response
Reproduction
https://codesandbox.io/p/sandbox/container-broken-popover-nl3prj
Code of Conduct
The text was updated successfully, but these errors were encountered: