Skip to content

Conversation

@liuliu-dev
Copy link
Contributor

@liuliu-dev liuliu-dev commented Oct 13, 2025

Summary

Unifies ActionList.Item and ActionList.LinkItem into a single ActionList.Item component that handles both regular items and link items. Users can create link items by simply adding href or other anchor attributes to ActionList.Item, without needing to choose between two separate components.

All existing ActionList.LinkItem usage continues to work unchanged.

Closes https://github.com/github/primer/issues/5956

Implementation

Link Container
Created LinkItemContainerNoBox following the pattern of ButtonItemContainerNoBox /DivItemContainerNoBox, used as ItemWrapper when Item should be rendered as a link .

The structure is similar to _PrivateItemWrapper used in the LinkItem, but with some props changes : passing userOnClick and inactiveText which are no longer in scope.

Props Merging
The challenge is ActionListItemProps now includes both previous ActionListItemProps and LinkProps.

To avoid breaking current usage and support migration from ActionList.LinkItem to ActionList.Item with just the component name change (no props change), defined INTERACTIVE_ELEMENT_PROPS const in shared.ts. This const is used to strip LinkItem-specific props and only pass containerOnlyProps to container, avoiding props like href showing up in <li>.

Props are split into interactiveProps and containerOnlyProps.

Migration
Change component name, props stay the same:

// Before
<ActionList.LinkItem href="/path">Link</ActionList.LinkItem>

// After
<ActionList.Item href="/path">Link</ActionList.Item>

Breaking Changes

Notes

  • The ESLint rule primer-react/prefer-action-list-item-onselect will need to be updated to allow onClick when link props are present.

  • Are these conditions sufficient to detect link items? Should any other props trigger link behavior?

  const isLinkItem = Boolean(
    props.href ||
      props.download ||
      props.target ||
      props.rel ||
      props.hrefLang ||
      props.to ||
      (typeof props.as === 'string' && props.as.toLowerCase() === 'a') ||
      role === 'link',
  )

Rollout strategy

  • Major release; if selected, include a written rollout or migration plan

@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2025

🦋 Changeset detected

Latest commit: c6f608b

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

This PR includes changesets to release 2 packages
Name Type
@primer/react Major
@primer/styled-react Major

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
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@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 Oct 13, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 13, 2025 22:35 Inactive
@liuliu-dev liuliu-dev added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 13, 2025
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 13, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 13, 2025 23:06 Inactive
@liuliu-dev liuliu-dev added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 14, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-6999 October 14, 2025 23:00 Abandoned
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 14, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 14, 2025 23:08 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 14, 2025 23:16 Inactive
@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 14, 2025
@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 Oct 29, 2025
@github-actions
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 29, 2025 23:14 Inactive
@github-actions github-actions bot added integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 29, 2025
@github-actions
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 29, 2025 23:44 Inactive
@github-actions github-actions bot removed the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 29, 2025
@primer-integration
Copy link

🔴 ci completed with status failure.

@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh labels Oct 30, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 30, 2025 00:32 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 30, 2025 00:47 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 30, 2025 15:56 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 30, 2025 16:11 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 30, 2025 20:54 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6999 October 30, 2025 23:00 Inactive
@liuliu-dev liuliu-dev force-pushed the liuliu/merge-linkitem-and-item-in-actionlist branch from b9b9731 to c6f608b Compare October 31, 2025 16:21
@primer-integration
Copy link

😢 Hi from github/github-ui. The integration workflow has failed: https://github.com/github/github-ui/actions/runs/18978867808

@liuliu-dev liuliu-dev closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: failing Changes in this PR cause breaking changes in gh/gh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants