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

@TylerJDevTylerJDev 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-botBot 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
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

@github-actionsgithub-actionsBot added the staff Author is a staff member label Jun 9, 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.

@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 Jun 9, 2026
@github-actions
github-actionsBottemporarily 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 ownerJune 9, 2026 23:21
@TylerJDev
TylerJDev requested review from Copilot and jonrohanJune 9, 2026 23:21
@TylerJDevTylerJDev 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-actionsBottemporarily deployed to storybook-preview-7964 June 9, 2026 23:24 Inactive

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

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
FileDescription
packages/react/src/SelectPanel/SelectPanel.tsxPasses cssAnchorPositioningSettings.disable for modal variant to preserve manual centering.
packages/react/src/AnchoredOverlay/AnchoredOverlay.tsxAdds new prop and gates native CSS anchor positioning behavior on disable.
.changeset/select-panel-modal-css-anchor-positioning.mdDeclares a minor bump and summarizes the new prop + SelectPanel behavior change.

Copilot's findings

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

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

primer-integrationBot 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

@github-actions
github-actionsBottemporarily deployed to storybook-preview-7964 June 10, 2026 12:02 Inactive
@TylerJDev
TylerJDev added this pull request to the merge queueJun 10, 2026
Merged via the queue into main with commit 0f0f79fJun 10, 2026
54 checks passed
@TylerJDev
TylerJDev deleted the tylerjdev/add-settings-for-css-anchor-positioning branch June 10, 2026 12:29
@primerprimerBot mentioned this pull request Jun 10, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

3 participants

@TylerJDev@jonrohan