Skip to content

Add height, width and overflow to Popover component #6303

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

Merged
merged 13 commits into from
Jul 15, 2025

Conversation

pksjce
Copy link
Contributor

@pksjce pksjce commented Jul 8, 2025

Closes https://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

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 01:35
@pksjce pksjce requested a review from a team as a code owner July 8, 2025 01:35
@pksjce pksjce requested a review from jonrohan July 8, 2025 01:35
Copy link

changeset-bot bot commented Jul 8, 2025

🦋 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
Name Type
@primer/react 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

@pksjce pksjce requested a review from mperrotti July 8, 2025 01:35
@github-actions github-actions bot 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
Copy link
Contributor

github-actions bot commented Jul 8, 2025

👋 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!

Copy link
Contributor

@Copilot Copilot AI left a comment

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.

File Description
packages/react/src/Popover/Popover.tsx Added new props to PopoverContentProps type and updated PopoverContent component implementation
packages/react/src/Popover/Popover.stories.tsx Updated Storybook stories to demonstrate new props and added controls for testing
packages/react/src/Popover/Popover.module.css Added CSS rules for width, height, and overflow variants using data attributes
packages/react/src/Popover/Popover.dev.stories.tsx Updated dev story to demonstrate overflow behavior

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

Copilot AI Jul 8, 2025

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;
Copy link
Preview

Copilot AI Jul 8, 2025

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.

@@ -33,6 +33,8 @@ Playground.args = {
caret: 'top',
open: true,
relative: true,
width: 'auto',
Copy link
Preview

Copilot AI Jul 8, 2025

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.

@@ -33,6 +33,8 @@ Playground.args = {
caret: 'top',
open: true,
relative: true,
width: 'auto',
height: 'auto',
Copy link
Preview

Copilot AI Jul 8, 2025

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.

Copy link
Contributor

github-actions bot commented Jul 8, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 91.9 KB (+0.03% 🔺)
packages/react/dist/browser.umd.js 92.23 KB (+0.14% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 8, 2025 01:44 Inactive
@pksjce pksjce force-pushed the pk/popover-width-height-overflow branch from c6834ab to f36ff28 Compare July 8, 2025 03:16
@github-actions github-actions bot requested a deployment to storybook-preview-6303 July 8, 2025 03:19 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 8, 2025 03:28 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 8, 2025 03:56 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 8, 2025 04:10 Inactive
@pksjce pksjce force-pushed the pk/popover-width-height-overflow branch from 7d10a6a to 49ebc1e Compare July 8, 2025 12:23
@github-actions github-actions bot requested a deployment to storybook-preview-6303 July 8, 2025 12:28 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 8, 2025 12:37 Inactive
@pksjce pksjce force-pushed the pk/popover-width-height-overflow branch from 8c9e1f0 to ef8ec56 Compare July 8, 2025 13:05
@pksjce pksjce requested a review from a team as a code owner July 8, 2025 13:05
@github-actions github-actions bot requested a deployment to storybook-preview-6303 July 8, 2025 13:08 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 8, 2025 13:18 Inactive
Copy link
Member

@francinelucca francinelucca left a comment

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

@@ -0,0 +1,5 @@
---
"@primer/react": patch
Copy link
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
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 11, 2025 03:58 Inactive
@pksjce pksjce requested a review from mperrotti July 13, 2025 22:53
@pksjce pksjce force-pushed the pk/popover-width-height-overflow branch from 4459633 to 6b3daed Compare July 14, 2025 05:17
@github-actions github-actions bot requested a deployment to storybook-preview-6303 July 14, 2025 05:24 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6303 July 14, 2025 05:33 Inactive
@pksjce pksjce force-pushed the pk/popover-width-height-overflow branch from 82df9b2 to a5b1c3a Compare July 14, 2025 21:55
@pksjce pksjce added this pull request to the merge queue Jul 15, 2025
Merged via the queue into main with commit c77acc4 Jul 15, 2025
43 checks passed
@pksjce pksjce deleted the pk/popover-width-height-overflow branch July 15, 2025 12:51
@primer primer bot mentioned this pull request Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This 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.

4 participants