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

Select Control (Epic): Refactor and consolidate logic #38226

Closed
1 of 14 tasks
joshuatf opened this issue May 10, 2023 · 1 comment
Closed
1 of 14 tasks

Select Control (Epic): Refactor and consolidate logic #38226

joshuatf opened this issue May 10, 2023 · 1 comment
Assignees
Labels
focus: product management Related to product creation and editing. package: @woocommerce/components issues related to @woocommerce/components team: Mothra WC Merchants activation and store management type: epic Container issue with high-level description of work that will be done in sprint.

Comments

@joshuatf
Copy link
Contributor

joshuatf commented May 10, 2023

Problem

This issue will act as an epic to house other issues around the __experimentalSelectControl and __experimentalSelectTreeControl components. There are two main issues we're facing with these components:

  1. We are duplicating a heavy amount of logic between these two components and should consolidate the efforts to reduce maintenance going forward.
  2. Downshift's API has been more limiting than we anticipated and we need to apply workarounds to create our blur/focus/selection logic.

Solution

We should strive to share as much code as possible between these components and break this into meaningful chunks that are reusable.

We can do this with a combination of hooks and pre-made components that handle the default render. If we are careful to decouple the render from the selection logic, we can make these components much more composable reducing limitations moving forward.

This may look something like this:

const {
	isOpen,
	selected,
	select,
	remove,
	comboBoxProps,
	getItemProps,
	menuProps,
} = useDropdown(
	items: [ ... ]
	initialSelected: [],
	multiple: true,
);
return <>
	<ComboBox { ...comboBoxProps }>
		<Menu { ...menuProps } />
		<SelectedItems items={ selected } />
	</ComboBox>
</>

Issues

Tasks

  1. package: @woocommerce/components
    joshuatf
  2. focus: new product ux focus: product management priority: high status: blocked team: Mothra
  3. focus: new product ux package: @woocommerce/components priority: high team: Mothra
  4. focus: new product ux package: @woocommerce/components team: Mothra
  5. focus: product management package: @woocommerce/components team: Mothra
    nathanss
  6. focus: product management needs: design feedback package: @woocommerce/components team: Mothra
@github-actions github-actions bot added the status: awaiting triage This is a newly created issue waiting for triage. label May 10, 2023
@louwie17 louwie17 added package: @woocommerce/components issues related to @woocommerce/components focus: product management Related to product creation and editing. and removed status: awaiting triage This is a newly created issue waiting for triage. labels May 12, 2023
@AnnaMag AnnaMag added the status: blocker Blockers for other work. label Aug 24, 2023
@rrennick rrennick added the team: Mothra WC Merchants activation and store management label Sep 8, 2023
@louwie17 louwie17 added Epic and removed status: blocker Blockers for other work. labels Dec 6, 2023
@retrofox retrofox self-assigned this Dec 13, 2023
@ralucaStan ralucaStan added type: epic Container issue with high-level description of work that will be done in sprint. and removed Epic labels Mar 19, 2024
@joshuatf
Copy link
Contributor Author

Closing this epic in favor of the FormTokenField component from GB in #45295.

I've left the child issues open and left references to the above issue where related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: product management Related to product creation and editing. package: @woocommerce/components issues related to @woocommerce/components team: Mothra WC Merchants activation and store management type: epic Container issue with high-level description of work that will be done in sprint.
Projects
None yet
Development

No branches or pull requests

6 participants