Skip to content

Conversation

@erickcelio
Copy link
Contributor

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

Screenshot 2026-01-14 at 12 43 18

Notes for Reviewers

@erickcelio erickcelio changed the title Overlay and modal keep position fixed feat: Overlay and modal keep position fixed Jan 14, 2026
Copy link

@tauantcamargo tauantcamargo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@erickcelio erickcelio changed the title feat: Overlay and modal keep position fixed feat:(Overlay/Modal) keep position fixed Jan 14, 2026
@erickcelio erickcelio changed the title feat:(Overlay/Modal) keep position fixed feat(Overlay/Modal): keep position fixed Jan 14, 2026
@erickcelio erickcelio force-pushed the overlay-and-modal-keep-position-fixed branch from 2ab1377 to a7fa6cc Compare January 14, 2026 15:52
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;
Copy link
Contributor

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

Copy link
Contributor

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?)

Copy link
Contributor Author

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"],
Copy link
Contributor

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?

Copy link
Contributor

@blvdmitry blvdmitry left a 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!

@erickcelio erickcelio requested a review from blvdmitry January 15, 2026 14:13
@blvdmitry blvdmitry merged commit cb5a628 into reshaped-ui:canary Jan 16, 2026
12 checks passed
@blvdmitry
Copy link
Contributor

Thanks, will release a canary over the weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants