Skip to content
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

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

Merged
merged 3 commits into from
Sep 1, 2021

Conversation

jfuchs
Copy link
Contributor

@jfuchs jfuchs commented Aug 31, 2021

This PR adds three styling rules to the primer-created portal container root: position: absolute, top: 0, left: 0. This doesn't add any styling to either roots provided via registerPortalRoot or roots provided by placing an element with id __primerPortalRoot__ in the DOM.

Why?

Compared to statically positioning a portal root after body content, absolutely positioning a portal root relative to the body will lead to more stable overlay positioning across DOM changes.

See also #1395

Screenshots

N/A

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@jfuchs jfuchs requested a review from a team August 31, 2021 22:23
@changeset-bot
Copy link

changeset-bot bot commented Aug 31, 2021

🦋 Changeset detected

Latest commit: 9ec1cba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2021

size-limit report 📦

Path Size
dist/browser.esm.js 48.45 KB (+0.04% 🔺)
dist/browser.umd.js 48.72 KB (+0.03% 🔺)

Copy link
Member

@dgreif dgreif left a comment

Choose a reason for hiding this comment

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

I'm a little nervous about this change, given the odd behavior we have been seeing in Safari without it. I'd give this some good testing, both in stories here and in Projects Beta, in all the three major browsers. If all looks good, I'm ok with this solution

@jfuchs jfuchs marked this pull request as draft September 1, 2021 17:10
@jfuchs jfuchs marked this pull request as ready for review September 1, 2021 18:54
@jfuchs jfuchs merged commit e4dac57 into main Sep 1, 2021
@jfuchs jfuchs deleted the jfuchs/default-portal-placement branch September 1, 2021 20:24
@primer-css primer-css mentioned this pull request Sep 1, 2021
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.

None yet

2 participants