-
Notifications
You must be signed in to change notification settings - Fork 640
feat(ActionList): Combine Item and LinkItem into unified Item component #6999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ories and checked DOM rendering
…-and-item-in-actionlist
🦋 Changeset detectedLatest commit: c6f608b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
👋 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.com/primer/react into liuliu/merge-linkitem-and-item-in-actionlist
|
👋 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! |
|
👋 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! |
|
🔴 ci completed with status |
b9b9731 to
c6f608b
Compare
|
😢 Hi from github/github-ui. The integration workflow has failed: https://github.com/github/github-ui/actions/runs/18978867808 |
Summary
Unifies
ActionList.ItemandActionList.LinkIteminto a singleActionList.Itemcomponent that handles both regular items and link items. Users can create link items by simply addinghrefor other anchor attributes toActionList.Item, without needing to choose between two separate components.All existing
ActionList.LinkItemusage continues to work unchanged.Closes https://github.com/github/primer/issues/5956
Implementation
Link Container
Created
LinkItemContainerNoBoxfollowing the pattern ofButtonItemContainerNoBox/DivItemContainerNoBox, used asItemWrapperwhen Item should be rendered as a link .The structure is similar to
_PrivateItemWrapperused in theLinkItem, but with some props changes : passinguserOnClickandinactiveTextwhich are no longer in scope.Props Merging
The challenge is
ActionListItemPropsnow includes both previousActionListItemPropsandLinkProps.To avoid breaking current usage and support migration from
ActionList.LinkItemtoActionList.Itemwith just the component name change (no props change), definedINTERACTIVE_ELEMENT_PROPSconst inshared.ts. This const is used to strip LinkItem-specific props and only passcontainerOnlyPropsto container, avoiding props likehrefshowing up in<li>.Props are split into
interactivePropsandcontainerOnlyProps.Migration
Change component name, props stay the same:
Breaking Changes
ActionList.LinkItemdeprecated (still works but will show deprecation warnings)ActionListItemPropsnow includes link props. And removed unusedtypeprop fromLinkProps, it caused type conflicts(https://github.com/github/github-ui/blob/b6bf6d94ab0a339243ebdcad5e6eeefce2b93f48/packages/copilot-chat/components/autocomplete/FileSuggestion.tsx#L8) when extending the interface.Notes
The ESLint rule
primer-react/prefer-action-list-item-onselectwill need to be updated to allowonClickwhen link props are present.Are these conditions sufficient to detect link items? Should any other props trigger link behavior?
Rollout strategy