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

New Select component props: optionSelectedLabelProp, optionSelectableLabelProp #28015

Open
1 task done
svpease opened this issue Nov 26, 2020 · 5 comments
Open
1 task done
Labels

Comments

@svpease
Copy link

svpease commented Nov 26, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

The "optionLabelProp" is useful for choosing a label for a selected option (that differs from how it appears in the dropdown), but it doesn't work for AutoComplete, which always uses "value" instead to populate its search field.

So that a new feature to change this behavior is backwards-compatible, I propose adding two new explicit props that will work whether or not a search field is being used to show its selected option.

The two new props: "optionSelectedLabelProp" (for how the label appears when an option is selected) and "optionSelectableLabelProp" (for how an option's label appears in the dropdown).

The two new props will also make more sense and be more straight-forward as people migrate away from using Option and OptionGroup JSX to specifying their options via the "options" prop.

What does the proposed API look like?

<Select
  mode="combobox"
  optionSelectedLabelProp="selectedLabel"
  optionSelectableLabelProp="selectableLabel"
  optionFilterProp="selectableLabel"
  options={[
    {
      label: <div className="family-name">Smith</div>,
      options: [
        {
          value: 50002,
          selectableLabel: <div className="name">John</div>,
          selectedLabel: 'John Smith (Musician)',
        },
        {
          value: 50003,
          selectableLabel: <div className="name">Jane</div>,
          selectedLabel: 'Jane Smith (Software Engineer)',
        },
      ]
    }
  ]}
/>
@svpease
Copy link
Author

svpease commented Nov 26, 2020

I would love any feedback on this feature request.

I already have a pull request for this feature, but can gladly alter it to accommodate requested changes.

You can view my pull request here and see it already passes all deployment checks: react-component/select#573

Looking forward to hearing back! Thanks!

@svpease
Copy link
Author

svpease commented Nov 30, 2020

Can someone please review this feature/pull request? (even if it is just when to expect feedback)

I spent countless hours learning the codebase over a span of two months to make these changes, and I would be immensely grateful!

@jhsu @vio @pmq20 @troynt

@jhsu
Copy link
Contributor

jhsu commented Nov 30, 2020

@svpease I'm not a core contributor, but looks good to me 😄

@svpease
Copy link
Author

svpease commented Dec 1, 2020

@svpease I'm not a core contributor, but looks good to me 😄

Thank you Joe! Do you have any idea what kind of timeframe it takes to get the attention of a core contributor?

@svpease
Copy link
Author

svpease commented Jan 28, 2021

@zombieJ I just realized I could tag you in this thread -- any chance I could get a review for this pull request?

I invested a solid amount of time encapsulating all logic for how options are created/updated for rc-select that I think will be great for the codebase.

Some time has passed since my PR, but I don't mind merging in changes between then and now if it has a shot of getting accepted. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants