Skip to content

ActionList: add gap between items behind feature flag#7976

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-actionlist-link-spacing
Open

ActionList: add gap between items behind feature flag#7976
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-actionlist-link-spacing

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Fixes https://github.com/github/primer/issues/6612

ActionList items render with no vertical separation, so adjacent hover/active backgrounds touch and look cramped. This adds a small gap between sibling items, gated behind a feature flag to avoid disturbing existing layouts.

Behavior is opt-in via primer_react_action_list_item_gap. When enabled, the list root gets a data-item-gap attribute and CSS applies margin-block-start: var(--base-size-2) (2px) between adjacent items.

Changelog

New

  • primer_react_action_list_item_gap feature flag (default false).
  • data-item-gap attribute on the ActionList root when the flag is enabled.
  • CSS rule adding a 2px gap between adjacent .ActionListItem siblings under [data-item-gap].
  • Storybook feature story "With gap between items".

Changed

  • None.

Removed

  • None.

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

Toggle the primer_react_action_list_item_gap flag in the feature story (or via the Storybook toolbar) and confirm items gain 2px of vertical separation; with the flag off, spacing is unchanged. Unit tests cover both default-off and flag-on states.

Open question carried over from the issue: the gap is set to the requested 2px minimum (--base-size-2); design still needs to confirm whether 4px is preferred — only the single token in the CSS rule changes if so.

Merge checklist

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ccc2b4f

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 Patch

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

Co-authored-by: jonrohan <54012+jonrohan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lack of gap between links in ActionList ActionList: add gap between items behind feature flag Jun 11, 2026
Copilot AI requested a review from jonrohan June 11, 2026 20:34
@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.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@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 Jun 11, 2026
@jonrohan jonrohan marked this pull request as ready for review June 11, 2026 20:58
@jonrohan jonrohan requested a review from a team as a code owner June 11, 2026 20:58
Copilot AI review requested due to automatic review settings June 11, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in (feature-flagged) visual gap between adjacent ActionList items to improve readability without changing default layouts.

Changes:

  • Introduces primer_react_action_list_item_gap (default false) in the default feature flag set.
  • When enabled, ActionList sets data-item-gap on the list root and CSS applies a 2px margin-block-start between adjacent .ActionListItem siblings.
  • Adds unit tests and a Storybook “feature” story demonstrating the flag-enabled appearance, plus a patch changeset.
Show a summary per file
File Description
packages/react/src/FeatureFlags/DefaultFeatureFlags.ts Registers the new feature flag with a default of false.
packages/react/src/ActionList/List.tsx Reads the flag via useFeatureFlag and conditionally adds data-item-gap to the ActionList root.
packages/react/src/ActionList/ActionList.test.tsx Verifies the data-item-gap attribute is absent by default and present when the flag is enabled.
packages/react/src/ActionList/ActionList.module.css Adds a [data-item-gap]-scoped rule that applies a 2px gap between adjacent items.
packages/react/src/ActionList/ActionList.features.stories.tsx Adds a Storybook feature story rendering ActionList with the flag enabled.
.changeset/action-list-item-gap.md Patch changeset describing the feature-flagged spacing adjustment.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment on lines +585 to +586
it('does not set data-item-gap by default', () => {
const {container} = HTMLRender(
@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  CI   Passed
skipped  VRT   skipped
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.

@jonrohan jonrohan requested a review from francinelucca June 11, 2026 23:19

@francinelucca francinelucca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approving as not to block this, but wondering if we might want to scope this just down to NavList or something 🤔. IDK that it's necessary for things like SelectPanel or plain ActionList, happy to defer to design though!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants