Skip to content

Overlay: Add popover support#7751

Open
TylerJDev wants to merge 7 commits intomainfrom
tylerjdev/add-popover-support-overlay
Open

Overlay: Add popover support#7751
TylerJDev wants to merge 7 commits intomainfrom
tylerjdev/add-popover-support-overlay

Conversation

@TylerJDev
Copy link
Copy Markdown
Member

@TylerJDev TylerJDev commented Apr 13, 2026

Closes https://github.com/github/primer/issues/6556

Adds popover support to Overlay component. With AnchoredOverlay now supporting popover, the Overlay component should too, to ensure implementations of AnchoredOverlay + Overlay work properly.

Changelog

New

  • Adds the popover API to Overlay (behind the primer_react_css_anchor_positioning feature flag)

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
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 414cc91

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

@TylerJDev TylerJDev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Apr 13, 2026
@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 Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@TylerJDev TylerJDev force-pushed the tylerjdev/add-popover-support-overlay branch from ab4489b to e949fce Compare April 14, 2026 02:14
@github-actions github-actions bot requested a deployment to storybook-preview-7751 April 14, 2026 02:19 Abandoned
@TylerJDev TylerJDev changed the title Add popover support overlay Overlay: Add popover support Apr 14, 2026
@github-actions github-actions bot temporarily deployed to storybook-preview-7751 April 14, 2026 02:30 Inactive
@TylerJDev TylerJDev requested a review from siddharthkp April 14, 2026 12:48
@github-actions github-actions bot requested a deployment to storybook-preview-7751 April 14, 2026 12:49 Abandoned
@primer-integration
Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/18562

@primer-integration
Copy link
Copy Markdown

Integration test results from github/github-ui:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

@TylerJDev TylerJDev marked this pull request as ready for review April 14, 2026 17:24
@TylerJDev TylerJDev requested a review from a team as a code owner April 14, 2026 17:24
Copilot AI review requested due to automatic review settings April 14, 2026 17:24
Copy link
Copy Markdown
Contributor

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

Adds Popover API support to Overlay to better interoperate with AnchoredOverlay when CSS anchor positioning / top-layer popovers are in use.

Changes:

  • Adds a popover prop to Overlay and attempts to auto-open via showPopover().
  • Adjusts Overlay CSS to reset UA popover styles.
  • Adds a nested-overlay dev story and VRT coverage for the nested scenario (with and without the feature flag).
Show a summary per file
File Description
packages/react/src/Overlay/Overlay.tsx Introduces popover prop and showPopover() behavior in Overlay.
packages/react/src/Overlay/Overlay.module.css Adds popover-specific CSS reset rules for Overlay.
packages/react/src/AnchoredOverlay/AnchoredOverlay.module.css Adds/clarifies comment in anchored overlay positioning CSS.
packages/react/src/AnchoredOverlay/AnchoredOverlay.dev.stories.tsx Adds a dev story demonstrating a nested Overlay inside an AnchoredOverlay.
e2e/components/AnchoredOverlay.test.ts Adds a VRT scenario that opens a nested overlay (runs in both flag modes).
.changeset/pretty-masks-kick.md Declares a minor release changeset for the new Overlay popover API support.

Copilot's findings

Comments suppressed due to low confidence (1)

packages/react/src/Overlay/Overlay.tsx:246

  • showPopover() is triggered whenever popover is set, even if visibility === 'hidden', and there’s no corresponding hidePopover() when visibility becomes hidden or when popover is unset. This can leave the element in :popover-open state while the component is “closed” via visibility, which may impact focus/interaction. Align this effect with the existing visibility semantics (skip when hidden, and/or hide the popover in cleanup when closing).
    useLayoutEffect(() => {
      if (!popover || !overlayRef.current || cssAnchorPositioning) return

      try {
        if (!overlayRef.current.matches(':popover-open')) {
          overlayRef.current.showPopover()
        }
      } catch {
        // Ignore if popover is already showing or not supported
      }
    }, [popover, cssAnchorPositioning])
  • Files reviewed: 6/6 changed files
  • Comments generated: 3

Comment on lines +204 to +208
inset: auto;
margin: 0;
padding: 0;
border: 0;
max-width: none;
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The [popover]:not([data-anchor-position]) rule sets inset: auto, which overrides the earlier top/left/right/bottom positioning rules for .Overlay. As a result, an Overlay using top/left props may no longer be positioned as intended when popover is present (it also removes the component’s default max-width constraint via max-width: none). Consider overriding the UA popover styles without clobbering the component’s positioning/sizing rules (e.g. explicitly re-apply top/left/right/bottom here, or avoid using the inset shorthand and keep the existing max-width).

Suggested change
inset: auto;
margin: 0;
padding: 0;
border: 0;
max-width: none;
margin: 0;
padding: 0;
border: 0;

Copilot uses AI. Check for mistakes.
children?: React.ReactNode
className?: string
responsiveVariant?: 'fullscreen' // we only support fullscreen today but we might add bottomsheet in the future
popover?: 'auto' | 'manual'
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Decided not to make it popover by default as I feel like this might consist of more than a minor change.

With it on by default, it seems to work the same, so maybe it's worth enabling it by by default. 🤔 We will need to add popover to instances across Dotcom, which is the con of having it opt-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR 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.

2 participants