-
Notifications
You must be signed in to change notification settings - Fork 146
feat(Overlay/Modal): keep position fixed #569
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
feat(Overlay/Modal): keep position fixed #569
Conversation
tauantcamargo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
2ab1377 to
a7fa6cc
Compare
| const { active: rendered, activate: render, deactivate: remove } = useToggle(active || false); | ||
| const { active: visible, activate: show, deactivate: hide } = useToggle(active || false); | ||
| const isDismissible = useIsDismissible({ active, contentRef, hasTrigger: false }); | ||
| const shouldBeContained = containerRef && !keepPositionFixed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also run "pnpm changeset" to add a changelog item?
blvdmitry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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