Skip to content

AnchoredOverlay: Add settings for CSS anchor positioning#7964

Merged
TylerJDev merged 4 commits into
mainfrom
tylerjdev/add-settings-for-css-anchor-positioning
Jun 10, 2026
Merged

AnchoredOverlay: Add settings for CSS anchor positioning#7964
TylerJDev merged 4 commits into
mainfrom
tylerjdev/add-settings-for-css-anchor-positioning

Conversation

@TylerJDev

@TylerJDev TylerJDev commented Jun 9, 2026

Copy link
Copy Markdown
Member

Overview

Adds a cssAnchorPositioningSettings prop to AnchoredOverlay with a disable option that opts an individual overlay out of native CSS anchor positioning. We use this for SelectPanel, specifically to disable CSS anchor positioning for the modal variant so it stays manually centered.

There may be cases where CSS anchored positioning is not wanted, so this allows users to disable that behavior. This would remain even when we deprecate (and remove) JS-based anchored positioning.

Changelog

New

  • Added a cssAnchorPositioningSettings?: {disable?: boolean} prop to AnchoredOverlay. Setting disable: true opts the overlay out of native CSS anchor positioning even when the primer_react_css_anchor_positioning feature flag is enabled and the browser supports it.

Changed

  • SelectPanel now passes cssAnchorPositioningSettings={{disable: variant === 'modal'}} so the modal variant remains manually centered instead of being repositioned by CSS anchor positioning.

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

The new prop is additive and optional, and the SelectPanel change is scoped to the modal variant, so this is backwards compatible. Matches the changeset (@primer/react minor).

Testing & Reviewing

  • Enable the primer_react_css_anchor_positioning feature flag in a browser that supports native CSS anchor positioning (e.g. recent Chrome).
  • Open a SelectPanel with variant="modal" and confirm it stays centered on screen instead of being repositioned next to its trigger.
  • Confirm anchored SelectPanel usages and other AnchoredOverlay consumers still position correctly — they don't set disable, so behavior is unchanged.

Merge checklist

@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e55eba7

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

@github-actions github-actions Bot added the staff Author is a staff member label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

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.

@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 Jun 9, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7964 June 9, 2026 22:48 Inactive
@TylerJDev TylerJDev marked this pull request as ready for review June 9, 2026 23:21
@TylerJDev TylerJDev requested a review from a team as a code owner June 9, 2026 23:21
@TylerJDev TylerJDev requested review from Copilot and jonrohan June 9, 2026 23:21
@TylerJDev TylerJDev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Jun 9, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7964 June 9, 2026 23:24 Inactive

Copilot AI 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

Adds an opt-out mechanism for native CSS anchor positioning in AnchoredOverlay, and applies it to keep SelectPanel’s modal variant manually centered even when the CSS-anchor feature flag is enabled.

Changes:

  • Added cssAnchorPositioningSettings?: {disable?: boolean} to AnchoredOverlay to allow opting out of native CSS anchor positioning.
  • Updated SelectPanel to disable native CSS anchor positioning for variant="modal".
  • Added a changeset for an @primer/react minor release.
Show a summary per file
File Description
packages/react/src/SelectPanel/SelectPanel.tsx Passes cssAnchorPositioningSettings.disable for modal variant to preserve manual centering.
packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx Adds new prop and gates native CSS anchor positioning behavior on disable.
.changeset/select-panel-modal-css-anchor-positioning.md Declares a minor bump and summarizes the new prop + SelectPanel behavior change.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 4

Comment thread packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx
Comment thread packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx
Comment thread packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx
Comment thread packages/react/src/SelectPanel/SelectPanel.tsx
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@primer-integration

primer-integration Bot commented Jun 10, 2026

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  CI   Passed
Running  VRT   Running
Waiting  Projects   Waiting

@TylerJDev TylerJDev added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 0f0f79f Jun 10, 2026
54 checks passed
@TylerJDev TylerJDev deleted the tylerjdev/add-settings-for-css-anchor-positioning branch June 10, 2026 12:29
@primer primer Bot mentioned this pull request Jun 10, 2026
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 staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants