Skip to content

AnchoredOverlay: Add support for CSS anchor positioning#7604

Merged
siddharthkp merged 87 commits intomainfrom
tylerjdev/css-anchor-positioning
Mar 11, 2026
Merged

AnchoredOverlay: Add support for CSS anchor positioning#7604
siddharthkp merged 87 commits intomainfrom
tylerjdev/css-anchor-positioning

Conversation

@TylerJDev
Copy link
Member

@TylerJDev TylerJDev commented Feb 26, 2026

The first batch of work to add CSS anchor positioning to overlay components.

Example of CSS anchor positioning:

Screen.Recording.2026-03-04.at.7.33.32.AM.mov
Video description

In the video, we show the `AnchoredOverlay` opening and being positioned directly under the trigger. We then show off the overlay repositioning when there's lack of space.

Changelog

New

  • Added support for CSS Anchor Positioning in AnchoredOverlay, gated by the primer_react_css_anchor_positioning feature flag.
  • Updated ActionMenu to ensure that the anchor button receives the correct anchor class for CSS anchor positioning, and improved merging of class names between anchor and button props.
  • Added new stories to AnchoredOverlay.features.stories.tsx to demonstrate anchor positioning in various layouts, including centered overlays, grid layouts, within dialogs (including nested and overflowing dialogs), scroll containers, and sticky headers.

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

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: 1364a4d

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 staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Feb 26, 2026
@github-actions
Copy link
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. Or, apply the integration-tests: skipped manually label to skip these checks.

@primer
Copy link
Contributor

primer bot commented Feb 26, 2026

🤖 Lint and formatting issues have been automatically fixed and committed to this PR.

@github-actions github-actions bot temporarily deployed to storybook-preview-7604 February 26, 2026 22:32 Inactive
@primer
Copy link
Contributor

primer bot commented Feb 26, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

@primer
Copy link
Contributor

primer bot commented Feb 26, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

@primer
Copy link
Contributor

primer bot commented Feb 27, 2026

🤖 Lint and formatting issues have been automatically fixed and committed to this PR.

@github-actions github-actions bot temporarily deployed to storybook-preview-7604 February 27, 2026 02:10 Inactive
@primer
Copy link
Contributor

primer bot commented Feb 27, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

@primer
Copy link
Contributor

primer bot commented Feb 27, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

I added e2e tests to compare this PR against: diff.

The diffs are only present with the feature flag ON. So that's good! Even though this feature isn't perfect yet, we can merge and continue to iterate on it.

Regressed:

AnchoredOverlay-Anchor-Alignment: default is not centered anymore.

image

 

AnchoredOverlay-Scroll-With-Anchor: default is not centered anymore

image

 

AnchoredOverlay-Fullscreen-Variant: Not fullscreen anymore

image

 

AnchoredOverlay-Offset-Alignment-From-Anchor: offset not respected

image

 

AnchoredOverlay-Offset-Position-From-Anchor: offset not respected

image

 

@primer-integration
Copy link

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

@primer-integration
Copy link

Integration test results from github/github-ui:

Passed  CI   Passed
Passed  VRT   Passed
Waiting  Projects   Waiting

@siddharthkp
Copy link
Member

Added integration-tests: skipped manually because tests are passing in the integration branch, but it wasn't reported fully: https://github.com/github/github-ui/pull/15793#issuecomment-4042824514

@primer primer bot mentioned this pull request Mar 11, 2026
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 integration-tests: skipped manually Changes in this PR do not require an integration test staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants