Skip to content
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

SelectPanel: Update SelectPanel to use modern ActionList #4794

Merged
merged 68 commits into from
Sep 10, 2024

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Jul 30, 2024

Note

New feature flag introduced: primer_react_select_panel_with_modern_action_list

What's changed

This is a pretty scary PR to roll out as it is replacing ActionList used internally in SelectPanel, that is why we are putting everything behind a feature flag (see FilteredActionList "entry file").

  • There should be no change without the feature flag enabled
  • Jest tests added for both states of the feature flag
  • VRT snapshots added for both states of the feature flag
  • Some accessibility remediations that were made to ActionList and not deprecated/ActionList do cause certain tests to fail in dotcom CI. I have a PR for dotcom updating tests that works with both states of the feature flag (can be merged independently)

Rollout strategy

  • Patch release (feature flagged)
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Merge checklist

Integration tests:

Copy link

changeset-bot bot commented Jul 30, 2024

🦋 Changeset detected

Latest commit: 0b57206

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

@github-actions github-actions bot added the staff Author is a staff member label Jul 30, 2024
@broccolinisoup broccolinisoup changed the title super wip Ignore - super wip selectpanel Jul 30, 2024
Copy link
Contributor

github-actions bot commented Jul 30, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 96.86 KB (+0.46% 🔺)
packages/react/dist/browser.umd.js 97.18 KB (+0.55% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-4794 July 30, 2024 05:18 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4794 July 31, 2024 02:21 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4794 July 31, 2024 04:09 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4794 July 31, 2024 05:35 Inactive
@broccolinisoup broccolinisoup added the skip changeset This change does not need a changelog label Jul 31, 2024
@broccolinisoup broccolinisoup changed the title Ignore - super wip selectpanel SelectPanel: Update SelectPanel to use modern ActionList Aug 1, 2024
Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

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

Awesome, nice work! As far as groups go, it looks like both the beta and deprecated versions of ActionList support them. Maybe we could create a sub-component called MappedActionListGroup? Then we could do something like:

function MappedActionListGroup({ items, header }: GroupProps) {
  return (
    <ActionList.Group>
      <ActionList.GroupHeading variant={header.variant}>
        {header.title}
      </ActionList.GroupHeading>
      {items.map((item) => <MappedActionList item={item}>)}
    </ActionList.Group>
  )
}

text,
variant,
disabled,
trailingVisual: TrailingVisual,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is a common pattern, but I personally find it a bit confusing to use TitleCase for these renamed variables. Can we avoid renaming them, or name them something else, eg. originalTrailingVisual?

Copy link
Member

Choose a reason for hiding this comment

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

👋

the TitleCase is so that we can render them as a component in JSX

prop accepted as leadingVisual, rendered in the body as <LeadingVisual/>, it would have been nicer if the prop was already TitleCased to signal that it accepts a component (and not a string, for example), but probably not the correct time to change that here

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

LGTM! Just had a question

if (activeDescendantRef.current && scrollContainerRef.current) {
scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {...menuScrollMargins, behavior: 'auto'})
}
}, [items])
Copy link
Member

Choose a reason for hiding this comment

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

Is items a memoized value or is a plain value typically?

Copy link
Member

Choose a reason for hiding this comment

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

They are memoized in SelectPanel before passing to FilteredActionList. Tell me more?

@joshblack
Copy link
Member

Also wanted to leave a question, would it be possible for this to go in the next release batch? (I think it would be rc.5)

Would help out a ton on my end, the release is starting to get big 😅

@siddharthkp
Copy link
Member

siddharthkp commented Sep 9, 2024

Also wanted to leave a question, would it be possible for this to go in the next release batch? (I think it would be rc.5)

Absolutely! I can wait :)

Update: rc.4 was merged yesterday, can merge this now 🎉

@siddharthkp siddharthkp changed the title SelectPanel: Update SelectPanel to use modern ActionList (waiting for rc.5) SelectPanel: Update SelectPanel to use modern ActionList Sep 9, 2024
@camertron camertron mentioned this pull request Sep 9, 2024
12 tasks
@siddharthkp siddharthkp changed the title (waiting for rc.5) SelectPanel: Update SelectPanel to use modern ActionList SelectPanel: Update SelectPanel to use modern ActionList Sep 10, 2024
@siddharthkp siddharthkp added this pull request to the merge queue Sep 10, 2024
Merged via the queue into main with commit 5f996c6 Sep 10, 2024
32 checks passed
@siddharthkp siddharthkp deleted the select-panel-action-list branch September 10, 2024 10:07
@primer primer bot mentioned this pull request Sep 10, 2024
@broccolinisoup
Copy link
Member Author

So happy to see this is merged!! Thanks @siddharthkp 🥹 💖

@primer primer bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants