Add ActionList.GroupHeading.LeadingVisual#7949
Conversation
Mirror the existing ActionList.GroupHeading.TrailingAction to add a leading visual to group headings, behind the primer_react_action_list_group_heading_leading_visual feature flag. The slot config is built from only the enabled flags so a disabled feature passes its child through unchanged and is never stripped by the other. For github/github-ui#22642.
🦋 Changeset detectedLatest commit: d0f6768 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
|
🤖 Lint issues have been automatically fixed and committed to this PR. |
|
🤖 Lint issues have been automatically fixed and committed to this PR. |
Replace the bespoke GroupHeadingLeadingVisual with the existing ActionList.LeadingVisual, mirroring how NavList.LeadingVisual reuses it. Group headings now share the same visual styling as items, and the public ActionList.GroupHeading.LeadingVisual API is unchanged.
|
🤖 Lint issues have been automatically fixed and committed to this PR. |
Summary
This adds a way to put a leading visual (an icon, usually) before the title in an
ActionList.Groupheading. Today you can already add a trailing action to a group heading; this gives you the matching thing on the other side.It mirrors the existing
ActionList.GroupHeading.TrailingActionAPI, so usage looks like this:It's gated behind a new
primer_react_action_list_group_heading_leading_visualfeature flag (off by default), and it can be combined withTrailingAction. Needed for github/github-ui#22642 (collapsed nav group popover).Implementation notes
TrailingActionit doesn't throw forlistbox/menuroles. It renders before the heading element so it never becomes part of the heading's accessible name.useSlotsconfig is built from only the enabled flags. That way, if one feature is on and the other off, the disabled one's child passes straight through to the heading unchanged rather than being stripped out.Changelog
New
ActionList.GroupHeading.LeadingVisual(behindprimer_react_action_list_group_heading_leading_visual).ActionListGroupHeadingLeadingVisualPropstype export.Changed
Removed
Rollout strategy
Testing & Reviewing
New unit tests in
Group.test.tsxcover: flag on (visual renders as a sibling of the heading, not inside it), flag off (passes through inside the heading),listboxrole, both leading + trailing together, and the case where only the trailing flag is on (leading visual is not stripped). A Storybook storyWith LeadingVisual on GroupHeading (behind feature flag)is added under ActionList → Features.Note: I wasn't able to run the local test/lint/type-check suite in my environment because
npm installfails to resolve@github/tab-container-element@4.8.2from the reachable registries. CI should run the full suite.Merge checklist