diff --git a/.changeset/dull-toys-crash.md b/.changeset/dull-toys-crash.md new file mode 100644 index 00000000000..29698b8b3d0 --- /dev/null +++ b/.changeset/dull-toys-crash.md @@ -0,0 +1,5 @@ +--- +'@primer/components': minor +--- + +Default portal containers created by primer are absolutely positioned at 0,0 diff --git a/src/Portal/Portal.tsx b/src/Portal/Portal.tsx index e8348ef776b..a2eaf32fecc 100644 --- a/src/Portal/Portal.tsx +++ b/src/Portal/Portal.tsx @@ -26,6 +26,9 @@ function ensureDefaultPortal() { if (!(defaultPortalContainer instanceof Element)) { defaultPortalContainer = document.createElement('div') defaultPortalContainer.setAttribute('id', PRIMER_PORTAL_ROOT_ID) + defaultPortalContainer.style.position = 'absolute' + defaultPortalContainer.style.top = '0' + defaultPortalContainer.style.left = '0' const suitablePortalRoot = document.querySelector('[data-portal-root]') if (suitablePortalRoot) { suitablePortalRoot.appendChild(defaultPortalContainer) diff --git a/src/__tests__/__snapshots__/AnchoredOverlay.tsx.snap b/src/__tests__/__snapshots__/AnchoredOverlay.tsx.snap index c98f4d4583d..0773df5c1ac 100644 --- a/src/__tests__/__snapshots__/AnchoredOverlay.tsx.snap +++ b/src/__tests__/__snapshots__/AnchoredOverlay.tsx.snap @@ -206,6 +206,7 @@ Object {