Skip to content

Add height, width and overflow to Popover component - #6303

Merged
pksjce merged 13 commits into
mainfrom
pk/popover-width-height-overflow
Jul 15, 2025
Merged

Add height, width and overflow to Popover component#6303
pksjce merged 13 commits into
mainfrom
pk/popover-width-height-overflow

Conversation

@pksjce

@pksjcepksjce commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

Closeshttps://github.com/github/primer/issues/4722

As described in the issue, we have consumers who are opting for AnchoredOverlay because of width restrictions in Popover.
I added the width values as suggested. I have also added height and overflow properties as they are adjacent concerns.

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

CopilotAI review requested due to automatic review settings July 8, 2025 01:35
@pksjce
pksjce requested a review from a team as a code ownerJuly 8, 2025 01:35
@pksjce
pksjce requested a review from jonrohanJuly 8, 2025 01:35
@changeset-bot

changeset-botBot commented Jul 8, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6748644

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

This PR includes changesets to release 1 package
NameType
@primer/reactMinor

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

@pksjce
pksjce requested a review from mperrottiJuly 8, 2025 01:35
@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 Jul 8, 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!

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds height, width, and overflow properties to the Popover component to address consumer needs who were previously using AnchoredOverlay due to width restrictions. The changes provide more flexible layout options for popover content.

  • Added width, height, and overflow props to PopoverContentProps with predefined size options
  • Updated PopoverContent component to handle the new props via data attributes
  • Added corresponding CSS rules for the new sizing and overflow behavior

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

FileDescription
packages/react/src/Popover/Popover.tsxAdded new props to PopoverContentProps type and updated PopoverContent component implementation
packages/react/src/Popover/Popover.stories.tsxUpdated Storybook stories to demonstrate new props and added controls for testing
packages/react/src/Popover/Popover.module.cssAdded CSS rules for width, height, and overflow variants using data attributes
packages/react/src/Popover/Popover.dev.stories.tsxUpdated dev story to demonstrate overflow behavior

/* stylelint-disable-next-line primer/responsive-widths */
width: 640px;
}
&:where([data-width-xxlarge]) {

CopilotAIJul 8, 2025

Copy link

Choose a reason for hiding this comment

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

The CSS defines a xxlarge width variant, but the TypeScript interface only includes xlarge as the largest option. This creates an inconsistency where the CSS supports a size that cannot be accessed through the component API.

Copilot uses AI. Check for mistakes.
height: 256px;
}
&:where([data-height-medium]) {
height: 320px;

CopilotAIJul 8, 2025

Copy link

Choose a reason for hiding this comment

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

There are trailing spaces after the semicolon on this line, which should be removed for consistency.

Suggested change
height:320px;
height:320px;

Copilot uses AI. Check for mistakes.
caret: 'top',
open: true,
relative: true,
width: 'auto',

CopilotAIJul 8, 2025

Copy link

Choose a reason for hiding this comment

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

The default args set width: 'auto', but the component implementation sets width = 'small' as the default. This inconsistency could confuse users about the actual default behavior.

Suggested change
width: 'auto',
width: 'small',

Copilot uses AI. Check for mistakes.
open: true,
relative: true,
width: 'auto',
height: 'auto',

CopilotAIJul 8, 2025

Copy link

Choose a reason for hiding this comment

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

The default args set height: 'auto', but the component implementation sets height = 'fit-content' as the default. This inconsistency could confuse users about the actual default behavior.

Suggested change
height: 'auto',
height: 'fit-content',

Copilot uses AI. Check for mistakes.
@github-actions

github-actionsBot commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js91.9 KB (+0.03% 🔺)
packages/react/dist/browser.umd.js92.23 KB (+0.14% 🔺)

@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 8, 2025 01:44 Inactive
@pksjce
pksjceforce-pushed the pk/popover-width-height-overflow branch from c6834ab to f36ff28CompareJuly 8, 2025 03:16
@github-actions
github-actionsBot requested a deployment to storybook-preview-6303 July 8, 2025 03:19 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 8, 2025 03:28 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 8, 2025 03:56 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 8, 2025 04:10 Inactive
@pksjce
pksjceforce-pushed the pk/popover-width-height-overflow branch from 7d10a6a to 49ebc1eCompareJuly 8, 2025 12:23
@github-actions
github-actionsBot requested a deployment to storybook-preview-6303 July 8, 2025 12:28 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 8, 2025 12:37 Inactive
@pksjce
pksjceforce-pushed the pk/popover-width-height-overflow branch from 8c9e1f0 to ef8ec56CompareJuly 8, 2025 13:05
@pksjce
pksjce requested a review from a team as a code ownerJuly 8, 2025 13:05
@github-actions
github-actionsBot requested a deployment to storybook-preview-6303 July 8, 2025 13:08 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 8, 2025 13:18 Inactive

@francineluccafrancinelucca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, looks like the width changes on all our stories and is now slightly wider due to the 232 -> 256px change. I'd confirm this is ok with design before merging this since we'll experience similar changes in dotcom

Comment thread.changeset/witty-paws-approve.md Outdated
@@ -0,0 +1,5 @@
---
"@primer/react": patch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"@primer/react": patch
"@primer/react": minor

just a suggestion 🤔

@pksjce
pksjce enabled auto-merge July 9, 2025 21:23
@pksjce
pksjce requested a review from mperrottiJuly 13, 2025 22:53
@pksjce
pksjceforce-pushed the pk/popover-width-height-overflow branch from 4459633 to 6b3daedCompareJuly 14, 2025 05:17
@github-actions
github-actionsBot requested a deployment to storybook-preview-6303 July 14, 2025 05:24 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 14, 2025 05:33 Inactive
@pksjce
pksjceforce-pushed the pk/popover-width-height-overflow branch from 82df9b2 to a5b1c3aCompareJuly 14, 2025 21:55
@github-actions
github-actionsBot requested a deployment to storybook-preview-6303 July 14, 2025 22:00 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6303 July 14, 2025 22:09 Inactive
@pksjce
pksjce added this pull request to the merge queueJul 15, 2025
Merged via the queue into main with commit c77acc4Jul 15, 2025
@pksjce
pksjce deleted the pk/popover-width-height-overflow branch July 15, 2025 12:51
@primerprimerBot mentioned this pull request Jul 15, 2025
@pksjcepksjce mentioned this pull request Sep 3, 2025
13 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommendedThis change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@pksjce@jonrohan@mperrotti@francinelucca