Skip to content

chore: add portal context - #6815

Merged
francinelucca merged 18 commits into
mainfrom
chore/add-portal-context
Sep 12, 2025
Merged

chore: add portal context#6815
francinelucca merged 18 commits into
mainfrom
chore/add-portal-context

Conversation

@francinelucca

@francineluccafrancinelucca commented Sep 9, 2025

Copy link
Copy Markdown
Member

This pull request introduces a new PortalContext to the @primer/react library, allowing more flexible and context-driven control over where portal content is rendered. The changes include updates to the core Portal component, its exports, new Storybook examples, and additional tests to ensure correct behavior when using PortalContext and container overrides.

Changelog

New

  • Added PortalContext to Portal.tsx, allowing consumers to specify a portalContainerName via React context, which determines the portal root container for content rendering. The Portal component now prioritizes the context value unless overridden by its own containerName prop.
  • Added new tests in Portal.test.tsx to verify correct portal rendering behavior when using PortalContext, including context-only, default fallback, undefined context, and prop override scenarios.
  • Added a Storybook example (WithPortalContext) in Portal.features.stories.tsx to demonstrate how to use PortalContext for controlling portal rendering, including context and prop override cases.

Changed

  • Updated exports in index.ts and the package entry point to include PortalContext, making it available for consumers.

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@changeset-bot

changeset-botBot commented Sep 9, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1884fcc

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

This PR includes changesets to release 2 packages
NameType
@primer/reactMinor
@primer/styled-reactMajor

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-actionsgithub-actionsBot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 9, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@francinelucca

Copy link
Copy Markdown
MemberAuthor

@copilot add tests to ensure elements render correctly inside custom Portal when PortalContext is supplied and on the default otherwise

CopilotAI commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

@francinelucca I've opened a new pull request, #6816, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions

github-actionsBot commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js89.62 KB (+0.11% 🔺)
packages/react/dist/browser.umd.js89.56 KB (-0.06% 🔽)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
@francinelucca

Copy link
Copy Markdown
MemberAuthor

@copilot add a storybook story that demonstrates how to use PortalContext to render items within a different Portal than the default

CopilotAI commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

@francinelucca I've opened a new pull request, #6821, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions
github-actionsBot requested a deployment to storybook-preview-6815 September 9, 2025 23:29 Abandoned
CopilotAIand others added 2 commits September 10, 2025 10:14
…#6821)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
Co-authored-by: Marie Lucca <francinelucca@github.com>
@francinelucca
francinelucca marked this pull request as ready for review September 10, 2025 14:18
CopilotAI review requested due to automatic review settings September 10, 2025 14:18
@francinelucca
francinelucca requested a review from a team as a code ownerSeptember 10, 2025 14:18
@github-actions
github-actionsBot requested a deployment to storybook-preview-6815 September 10, 2025 14:19 Abandoned

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actionsgithub-actionsBot added integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 11, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@francinelucca

Copy link
Copy Markdown
MemberAuthor

@copilot fix the accessibility issue with the dark theme by using token background colors from the theme

CopilotAI commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

@francinelucca I've opened a new pull request, #6847, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actionsgithub-actionsBot removed the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 12, 2025
CopilotAIand others added 2 commits September 12, 2025 14:23
…ckground colors (#6847)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actionsgithub-actionsBot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 12, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions
github-actionsBot requested a deployment to storybook-preview-6815 September 12, 2025 18:26 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6815 September 12, 2025 18:35 Inactive
@francinelucca
francinelucca added this pull request to the merge queueSep 12, 2025
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 12, 2025
@francinelucca
francinelucca added this pull request to the merge queueSep 12, 2025
Merged via the queue into main with commit 2024709Sep 12, 2025
43 checks passed
@francinelucca
francinelucca deleted the chore/add-portal-context branch September 12, 2025 21:58
@primerprimerBot mentioned this pull request Sep 12, 2025
pksjce pushed a commit that referenced this pull request Sep 18, 2025
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Adam Dierkens <adierkens@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passingChanges in this PR do NOT cause breaking changes in gh/ghintegration-tests: recommendedThis change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpmstaffAuthor is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@francinelucca@joshblack@adierkens