feat(Overlay/Modal): keep position fixed#569
Conversation
2ab1377 to
a7fa6cc
Compare
There was a problem hiding this comment.
wondering if we can make the API better here, a few thoughts:
- maybe we can avoid adding a prop at all in case we can detect a shadow root around the modal. Might be hard to detect since originally it doesn't render anything, but maybe we can do that while opening the modal. It also might be tricky since there can be use cases of apps using web components but still rendering modals on the top level of the document
- in case first is not an option, I would at least consider a clearer name for the prop, right now I feel how it's named after the description of the issue you're having but it might be not as clear for those who haven't used the property before. Maybe something along the lines of "displaying above the page and not the container" since that's what fixed is doing in the end
There was a problem hiding this comment.
(actually maybe something closer to "contained" which is true by default when you pass a containerRef but can be set to false?)
There was a problem hiding this comment.
yeah, that sounds great. I think we can stick with the prop version for cases like you said, where we want to keep it contained even inside a shadow root, so we don't limit its usage
| blurred && s["--blurred"], | ||
| animated && s["--animated"], | ||
| containerRef && s["--contained"], | ||
| shouldBeContained && s["--contained"], |
There was a problem hiding this comment.
Can you also run "pnpm changeset" to add a changelog item?
blvdmitry
left a comment
There was a problem hiding this comment.
Looks good overall, left a few minor comments and we can merge then, thanks!
|
Thanks, will release a canary over the weekend |
Summary
This will help when we need to use containerRef for some reason, but we don't want the modal to be limited to the element's size.
Related Issue
#568
Screenshots / Recordings
Notes for Reviewers