Skip to content

Commit

Permalink
Default portal containers created by primer are absolutely positioned…
Browse files Browse the repository at this point in the history
… at 0,0 (#1398)

* Default portal containers created by primer are absolutely positioned at 0,0

* changeset and snapshot

Co-authored-by: Dusty Greif <dgreif@users.noreply.github.com>
  • Loading branch information
jfuchs and dgreif committed Sep 1, 2021
1 parent 83b888f commit e4dac57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-toys-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': minor
---

Default portal containers created by primer are absolutely positioned at 0,0
3 changes: 3 additions & 0 deletions src/Portal/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/__snapshots__/AnchoredOverlay.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Object {
</button>
<div
id="__primerPortalRoot__"
style="position: absolute; top: 0px; left: 0px;"
>
<div
style="position: relative; z-index: 1;"
Expand Down Expand Up @@ -250,6 +251,7 @@ Object {
</button>
<div
id="__primerPortalRoot__"
style="position: absolute; top: 0px; left: 0px;"
>
<div
style="position: relative; z-index: 1;"
Expand Down

0 comments on commit e4dac57

Please sign in to comment.