Skip to content

chore: always render ActionMenu in viewport when inside Dialog under feature flag#7524

Open
francinelucca wants to merge 15 commits intomainfrom
chore/action-menu-display-in-viewport-enhancement
Open

chore: always render ActionMenu in viewport when inside Dialog under feature flag#7524
francinelucca wants to merge 15 commits intomainfrom
chore/action-menu-display-in-viewport-enhancement

Conversation

@francinelucca
Copy link
Member

@francinelucca francinelucca commented Feb 11, 2026

Relates to https://github.com/github/primer/issues/6361

Implements @TylerDixon's suggestion to have the ActionMenu.Overlay be able to detect if its being rendered inside a Dialog (via a (new) DialogContext) to then apply displayInViewport=true. Adding this under a feature flag since its somewhat of a widespread change.

Changelog

New

  • add DialogContext to Dialog
  • Added the primer_react_action_menu_display_in_viewport_inside_dialog feature flag to DefaultFeatureFlags, enabling control over overlay display behavior inside dialogs.
  • Updated ActionMenu.Overlay to use the new feature flag and detect if it is inside a Dialog, modifying the displayInViewport prop logic accordingly.

Changed

  • Wrapped the ActionMenu InsideDialog story in FeatureFlags and removed the explicit displayInViewport prop from ActionMenu.Overlay, relying on the feature flag for behavior.

Removed

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

@francinelucca francinelucca requested a review from a team as a code owner February 11, 2026 02:01
@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2026

🦋 Changeset detected

Latest commit: 1680a45

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 Feb 11, 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 Feb 11, 2026
@github-actions
Copy link
Contributor

👋 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.

Copy link
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 a feature-flagged behavior change so ActionMenu.Overlay can automatically opt into displayInViewport when rendered inside a portal (e.g., inside a Dialog), aiming to improve overlay positioning/clipping in portaled contexts.

Changes:

  • Adds a new default feature flag: primer_react_action_menu_display_in_viewport_inside_portal.
  • Updates ActionMenu.Overlay to consult the feature flag and detect whether it is inside a portal to adjust displayInViewport.
  • Updates the InsideDialog ActionMenu story to enable the flag and remove the explicit displayInViewport prop.

Reviewed changes

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

File Description
packages/react/src/Portal/Portal.tsx Attempts to ensure a “default” PortalContext exists so descendants can detect portal rendering.
packages/react/src/FeatureFlags/DefaultFeatureFlags.ts Registers the new feature flag with a default value of false.
packages/react/src/ActionMenu/ActionMenu.tsx Adds feature-flag logic and portal detection to influence displayInViewport.
packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx Enables the feature flag in the InsideDialog story and relies on the new default behavior.

@github-actions github-actions bot requested a deployment to storybook-preview-7524 February 11, 2026 02:08 Abandoned
@francinelucca francinelucca marked this pull request as draft February 11, 2026 02:11
Copy link
Contributor

Copilot AI commented Feb 11, 2026

@francinelucca I've opened a new pull request, #7525, to work on those changes. Once the pull request is ready, I'll request review from you.

Updated the version of '@primer/react' from patch to minor and modified the ActionMenu rendering behavior.
…e_portal feature flag (#7525)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
Copy link
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@primer-integration
Copy link

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

@primer-integration
Copy link

Integration test results from github/github-ui:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

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.

Left a question/suggestion, approving in advance

@@ -0,0 +1,5 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

lol the filename, didn't know changesets was anti-marriage

@github-actions github-actions bot requested a deployment to storybook-preview-7524 February 13, 2026 04:49 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-7524 February 13, 2026 04:58 Inactive
@francinelucca francinelucca changed the title chore: always render ActionMenu in viewport when inside portal under feature flag chore: always render ActionMenu in viewport when inside Dialog under feature flag Feb 13, 2026
@github-actions github-actions bot requested a deployment to storybook-preview-7524 February 13, 2026 05:14 Abandoned
Copy link
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

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

Comment on lines +323 to +325
const featureFlagDisplayInViewportInsidePortal = useFeatureFlag(
'primer_react_action_menu_display_in_viewport_inside_dialog',
)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Variable name says "InsidePortal" but should say "InsideDialog" to match the feature flag name and the actual feature being implemented. The feature is about detecting if the ActionMenu is inside a Dialog, not inside a Portal.

Copilot uses AI. Check for mistakes.
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 staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants