Skip to content

Fix ActionMenu bugs - #1401

Merged
rezrah merged 3 commits into
mainfrom
rezrah/action-menu-updates
Jul 20, 2026
Merged

Fix ActionMenu bugs#1401
rezrah merged 3 commits into
mainfrom
rezrah/action-menu-updates

Conversation

@rezrah

@rezrah rezrah commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes multiple issues in the ActionMenu component.

Fixes #1372
Fixes #1366
Fixes #1397

List of notable changes:

  • Adds variant rendering of non-split action menu. Now supports all Button variants, previously ignored
  • Adds rendering of the leadingVisual in non-split action menu, previously ignored
  • Adds onClick forwarding to non-split action menu, previously ignored
  • Updates data-attribute forwarding to correct child component

What should reviewers focus on?

  • Check the stories and code.
  • Are we happy to allow ActionMenu default mode button to appear in different colors? This was intentionally unavailable before.

Steps to test:

  1. See non-split ActionMenu in different colors here
  2. See leadingVisual in non-split ActionMenu here.
  3. Generally review all stories. Non-visual changes are validated through tests.

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

Please try to provide before and after screenshots or videos

Leading visual

Before After
N/A Screenshot 2026-07-15 at 14 01 50

Alternative variants

Before After
N/A Screenshot 2026-07-15 at 14 01 43

Copilot AI review requested due to automatic review settings July 15, 2026 12:59
@rezrah
rezrah requested a review from a team as a code owner July 15, 2026 12:59
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8420c03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@primer/react-brand Minor
@primer/brand-docs Minor
@primer/brand-css Minor
@primer/brand-primitives Minor
@primer/brand-e2e Minor
@primer/brand-fonts Minor
@primer/brand-mcp Minor
@primer/brand-config Minor
@primer/brand-storybook 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

@rezrah rezrah changed the title Fix ActionMenu bug Fix ActionMenu bugs Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🟢 No design token changes found

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🟢 Bundle size report

CheckMainBranchChange
UMD — full bundle (JS)101.47 kB101.39 kB✅ -81 B (-0.1%)
UMD — full bundle (CSS)66.92 kB66.92 kB🟢 No change
ESM — full bundle (JS + CSS)1.51 MB1.51 MB⬆️ +112 B (+0.0%)
ESM — tree-shaken simple (Button)69.81 kB69.81 kB🟢 No change
ESM — tree-shaken complex (ActionMenu)78.59 kB78.70 kB⬆️ +116 B (+0.1%)

@github-actions

Copy link
Copy Markdown
Contributor

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes several ActionMenu.Button inconsistencies/bugs so that default mode behaves more like split-button mode (variant/leadingVisual support and click forwarding), and so split-button mode forwards consumer attributes to the intended (“primary action”) button. It also adds Storybook coverage plus unit/visual tests and a changeset entry.

Changes:

  • Forward variant and leadingVisual to the default-mode Button, and forward/correct onClick + menu toggle behavior.
  • Correct attribute forwarding in split-button mode so consumer attributes apply to the primary action (not the menu toggle).
  • Add/extend unit tests, visual snapshot coverage, and Storybook feature stories for the fixed behaviors.
Show a summary per file
File Description
packages/react/src/ActionMenu/ActionMenu.tsx Adds menu-toggle callback plumbing and updates ActionMenu.Button rendering/prop forwarding in default and split-button modes.
packages/react/src/ActionMenu/ActionMenu.test.tsx Adds unit tests covering default-mode onClick + toggle, default-mode variant/leadingVisual, and split-button attribute/onClick separation.
packages/react/src/ActionMenu/ActionMenu.visual.spec.ts Adds visual snapshots for the new default-mode variant + leadingVisual stories.
packages/react/src/ActionMenu/ActionMenu.features.stories.tsx Adds new feature stories to demonstrate default-mode variant rendering and leadingVisual rendering.
.changeset/fix-action-menu-split-button-click.md Documents the user-visible changes and the split-button attribute forwarding behavior change.

Review details

  • Files reviewed: 5/7 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread packages/react/src/ActionMenu/ActionMenu.tsx
Comment thread packages/react/src/ActionMenu/ActionMenu.test.tsx
Comment thread packages/react/src/ActionMenu/ActionMenu.test.tsx
@github-actions

Copy link
Copy Markdown
Contributor

🟢 Unit test coverage changes found

Unit test coverage has been updated through this PR.

Changes: 0 new tests, 0 removed tests, 1 improved, 0 decreased

Component/Hook Statements Functions Branches Change
ActionMenu 94.4% 94.6% 89.7% 90.0% 87.4% 87.7% +0.3%

@rezrah
rezrah requested a review from danielguillan July 15, 2026 15:28

@danielguillan danielguillan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks great! Thank you for the fixes. We only need to update the React documentation to include the newly supported variant in the props table and revise the split-button guidance. 🚀

@rezrah
rezrah merged commit bbbc4b3 into main Jul 20, 2026
17 checks passed
@rezrah
rezrah deleted the rezrah/action-menu-updates branch July 20, 2026 12:42
@primer primer Bot mentioned this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants