Skip to content

Revert "AnchoredOverlay: Add support for CSS anchor positioning (#7604)"#7657

Merged
francinelucca merged 1 commit intomainfrom
chore/revert-test
Mar 12, 2026
Merged

Revert "AnchoredOverlay: Add support for CSS anchor positioning (#7604)"#7657
francinelucca merged 1 commit intomainfrom
chore/revert-test

Conversation

@francinelucca
Copy link
Copy Markdown
Member

@francinelucca francinelucca commented Mar 12, 2026

This reverts commit 61ae74c.

Saw some visual regressions during release testing, reverting

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 12, 2026

⚠️ No Changeset found

Latest commit: 654ff80

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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 Mar 12, 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.

@primer-integration
Copy link
Copy Markdown

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

@primer-integration
Copy link
Copy Markdown

Integration test results from github/github-ui:

Passed  CI   Passed
Failed  VRT   Failed
Passed  Projects   Passed

VRT check ensures that when visual differences are detected, the PR cannot proceed until someone acknowledges the changes by adding the "visual difference acknowledged" label.

Need help? If you believe this failure is unrelated to your changes, please reach out to the Primer team for assistance.

@francinelucca francinelucca marked this pull request as ready for review March 12, 2026 16:45
@francinelucca francinelucca requested a review from a team as a code owner March 12, 2026 16:45
@francinelucca francinelucca added the integration-tests: skipped manually Changes in this PR do not require an integration test label Mar 12, 2026
@francinelucca francinelucca enabled auto-merge March 12, 2026 16:50
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

This PR reverts the previously-added CSS anchor positioning support for AnchoredOverlay, removing the feature-flagged implementation and its related dependency/configuration so AnchoredOverlay/Overlay return to portal-based positioning.

Changes:

  • Removed the primer_react_css_anchor_positioning feature flag and all related code paths (polyfill loading, data attributes, wrapper/anchor CSS).
  • Restored Overlay to always render via Portal and simplified associated CSS positioning rules.
  • Cleaned up tests/stories/dependencies to remove the feature-flag-specific behavior and dependency (@oddbird/css-anchor-positioning).

Reviewed changes

Copilot reviewed 11 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/react/src/Overlay/Overlay.tsx Removes CSS anchor positioning feature-flag branching; always portals overlays.
packages/react/src/Overlay/Overlay.module.css Removes anchor-position gating selectors; applies positioning vars unconditionally.
packages/react/src/FeatureFlags/DefaultFeatureFlags.ts Removes the CSS anchor positioning flag from defaults.
packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx Removes CSS anchor positioning code path and polyfill behavior.
packages/react/src/AnchoredOverlay/AnchoredOverlay.test.tsx Drops feature-flag parameterized tests and related assertions.
packages/react/src/AnchoredOverlay/AnchoredOverlay.module.css Removes CSS anchor positioning classes (Wrapper, Anchor, AnchoredOverlay).
packages/react/src/ActionMenu/ActionMenu.tsx Removes className merging logic in anchor cloning/handler merging paths.
packages/react/src/ActionMenu/ActionMenu.test.tsx Removes feature-flag-based coverage for CSS anchor positioning behavior.
packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx Removes example stories added for CSS anchor positioning demo scenarios.
packages/react/package.json Removes @oddbird/css-anchor-positioning dependency.
package-lock.json Updates lockfile to reflect dependency removal and resulting tree changes.
.playwright/snapshots/components/AnchoredOverlay.test.ts-snapshots/css-anchor-positioning Updates VRT snapshots for the CSS-anchor-positioning variant.
.changeset/nine-buttons-lose.md Removes the changeset associated with the reverted feature.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +256 to 264
top={position?.top || 0}
left={position?.left || 0}
responsiveVariant={variant.narrow === 'fullscreen' ? 'fullscreen' : undefined}
anchorSide={cssAnchorPositioning ? undefined : position?.anchorSide}
className={clsx(className, overlayClassName, cssAnchorPositioning ? classes.AnchoredOverlay : undefined)}
anchorSide={position?.anchorSide}
className={className}
preventOverflow={preventOverflow}
data-component="AnchoredOverlay"
{...restOverlayProps}
{...overlayProps}
ref={node => {
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

AnchoredOverlay sets className={className} but then spreads ...overlayProps afterward, so overlayProps.className will override (not merge with) the className prop. This makes it impossible to reliably add a class via className when consumers also provide overlayProps.className (which is used widely in stories). Consider merging the two class names explicitly (and avoid overriding either).

See below for a potential fix:

          preventOverflow={preventOverflow}
          data-component="AnchoredOverlay"
          {...overlayProps}
          className={clsx(className, overlayProps?.className)}

Copilot uses AI. Check for mistakes.
Comment on lines 234 to 239
{React.cloneElement(child, {
...anchorProps,
ref: anchorRef,
className: clsx(anchorProps.className, child.props.className),
onClick: onButtonClick,
onKeyDown: onButtonKeyDown,
})}
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

ActionMenu.Anchor clones its child with ...anchorProps but no longer merges className with child.props.className. If the wrapped element already has a className (common for custom triggers), it will be overwritten by ActionMenu.Anchor's className prop, causing styling regressions. Consider merging the two class names when cloning.

Copilot uses AI. Check for mistakes.
export const DefaultFeatureFlags = FeatureFlagScope.create({
primer_react_breadcrumbs_overflow_menu: false,
primer_react_css_anchor_positioning: false,
primer_react_css_has_selector_perf: false,
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This PR removes the primer_react_css_anchor_positioning flag from defaults, but the Playwright VRT still runs each AnchoredOverlay story twice (with and without that flag) and maintains a second set of *-css-anchor-positioning-* snapshots. If the feature is fully reverted, the VRT parameterization and snapshots should also be removed/updated to avoid redundant coverage and future confusion.

Suggested change
primer_react_css_has_selector_perf: false,
primer_react_css_has_selector_perf: false,
primer_react_css_anchor_positioning: false,

Copilot uses AI. Check for mistakes.
Comment on lines +642 to +643
Github
</ActionList.LinkItem>
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

Brand spelling: "Github" should be "GitHub".

Copilot uses AI. Check for mistakes.
@francinelucca francinelucca added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit e4de5d8 Mar 12, 2026
66 checks passed
@francinelucca francinelucca deleted the chore/revert-test branch March 12, 2026 17:07
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.

3 participants