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

[EuiComboBox] Add option to singleSelection that allows editing #6869

Closed
j-m opened this issue Jun 22, 2023 · 7 comments · Fixed by #7332
Closed

[EuiComboBox] Add option to singleSelection that allows editing #6869

j-m opened this issue Jun 22, 2023 · 7 comments · Fixed by #7332
Assignees
Labels
feature request help wanted The EUI team is looking for community members to pick up and implement this issue

Comments

@j-m
Copy link
Contributor

j-m commented Jun 22, 2023

Given an EuiComboBox with singleSelection={{ asPlainText: true }} and onCreateOption (see EUI docs example)

I want to be able to edit the existing selected value rather than entirely deleting it (afterall, we have the isClearable prop)
(In other words, I want the combobox to behave as a regular input field rather than as pills)
So that I can make minor adjustments without having to remember what I previously entered

This is useful for large datasets with minor variations between options.

I had considered EuiSuggest but there were no examples of enabling custom options or its use with basic options i.e. plaintext (I have over 3500 options in this dropdown, soon to be an order of magnitude or two more).

Tbh EuiCombobox and EuiSuggest are pretty similar, it'd be nice to have a Do and Don't doc for when to use each altho I see a couple issues around this already #2708 #2841

While I'm here, it'd probably be worth you adding a notice to Case-sensitive matching and Async to explain that the consumer's own onSearchChange will have to implement the case-sensitivity i.e. that they're incompatible

@cee-chen cee-chen added the help wanted The EUI team is looking for community members to pick up and implement this issue label Jun 26, 2023
@github-actions
Copy link

👋 Thank you for your suggestion or request! While the EUI team agrees that it's valid, it's unlikely that we will prioritize this issue on our roadmap. We'll leave the issue open if you or anyone else in the community wants to implement it by contributing to EUI. If not, this issue will auto close in one year.

@cee-chen
Copy link
Member

Hey @j-m! I definitely see your UX case with singleSelection and custom options. That being said, it's pretty low priority for us as a team right now. We'd 100% accept an open source contribution with that functionality however, if you're interested in opening a PR with it!

Tbh EuiCombobox and EuiSuggest are pretty similar, it'd be nice to have a Do and Don't doc for when to use each

100%. Honestly, we have way too many select components in general and we need better guidance on when to use each 🥲 This has been on our radar for a while, so I went ahead and opened an issue for it: #6880

While I'm here, it'd probably be worth you adding a notice to Case-sensitive matching and Async to explain that the consumer's own onSearchChange will have to implement the case-sensitivity i.e. that they're incompatible

Totally valid! @breehall, would you be interested in opening a docs PR with this change as part of your support work this week? It might be good to document that both in the prop's types and in the actual src-docs copy.

@usmanabdurrehman
Copy link

Hi @cee-chen Can I try to implement this editable single selection feature?

@cee-chen
Copy link
Member

We'd absolutely accept a community PR on this functionality!

For some guidance on the kind of logic I'd expect, I'd suggest detecting singleSelection.plainText on delete keypress and adding a custom handler/branch for that (i.e., delete the pill and insert its value/text back into the input minus one character, so that it "appears" as if only one character has been deleted).

@usmanabdurrehman
Copy link

Cool. Thanks for the guidance @cee-chen

@cee-chen
Copy link
Member

cee-chen commented Nov 2, 2023

@j-m FYI this is coming in the next EUI upgrade, and won't require an extra option - the plain text single selection mode will simply act more like an EuiFieldText by default. Feel free to try it out here: https://eui.elastic.co/pr_7332/#/forms/combo-box#single-selection

@j-m
Copy link
Contributor Author

j-m commented Nov 2, 2023

Wonderful! Thank you, @cee-chen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request help wanted The EUI team is looking for community members to pick up and implement this issue
Projects
None yet
3 participants