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

SQFormAutocomplete allow user to set value not in list of options. #249

Closed
Chris-Boyle opened this issue May 12, 2021 · 5 comments
Closed
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Chris-Boyle
Copy link
Contributor

Chris-Boyle commented May 12, 2021

The proposal is to allow consumers of the SQFormAutocomplete component to opt into allowing an option not in the list options to be set for the field.

Instead of seeing the "No options" in the list when you type something that is not in the list we would add an option for what they have typed like:
stack it like :

No Option Found
Use “whatevs I’ve typed”

They would then be able to select that value and have their value that doesn't exist in our list persist

20BBrown14 added a commit that referenced this issue May 14, 2021
SQFormAutocomplete has the option to be free solo and allow values not
in the options array.

✅ Closes: #249
@20BBrown14
Copy link
Contributor

I was looking into this and turns out MUI allows this already with freeSolo prop. So we would just have to do a little work to make it work with Formik. I've got a branch here showing it working, here's the diff: https://github.com/SelectQuoteLabs/SQForm/compare/issue-249

If we decide this a feature we want we would need to add it to SQFormAsyncAutocomplete in a similar manner.

@SeanGroff
Copy link
Contributor

I was looking into this and turns out MUI allows this already with freeSolo prop. So we would just have to do a little work to make it work with Formik. I've got a branch here showing it working, here's the diff: https://github.com/SelectQuoteLabs/SQForm/compare/issue-249

If we decide this a feature we want we would need to add it to SQFormAsyncAutocomplete in a similar manner.

We've used this prop somewhere in the past. I thought it was on the AutoComplete component. Maybe it got removed. Anyways, I read through the docs and MUI suggests adding a few more properties in addition to the freeSolo prop.

https://material-ui.com/components/autocomplete/#creatable

If freeSolo={true} our component should add those ^ props as well.

We have 1 final design decision to make, I'm passing the below video to Nemeth for final direction.

https://www.loom.com/share/72bbab30fedf481abc9de4b3ce31e71a

@codyarose
Copy link
Contributor

I was looking into this and turns out MUI allows this already with freeSolo prop.

We've used this prop somewhere in the past. I thought it was on the AutoComplete component. Maybe it got removed.

It was removed to fix a different issue; #214

@SeanGroff
Copy link
Contributor

SeanGroff commented May 17, 2021

I was looking into this and turns out MUI allows this already with freeSolo prop.

We've used this prop somewhere in the past. I thought it was on the AutoComplete component. Maybe it got removed.

It was removed to fix a different issue; #214

Got it!
Hopefully, our tests will help us this time around 💯

This time around, the approach is freeSolo should be configured to accept a boolean. It looks like the previous issue was due to freeSolo deriving it's value from 'isDisabled

@SeanGroff
Copy link
Contributor

I was looking into this and turns out MUI allows this already with freeSolo prop. So we would just have to do a little work to make it work with Formik. I've got a branch here showing it working, here's the diff: https://github.com/SelectQuoteLabs/SQForm/compare/issue-249
If we decide this a feature we want we would need to add it to SQFormAsyncAutocomplete in a similar manner.

We've used this prop somewhere in the past. I thought it was on the AutoComplete component. Maybe it got removed. Anyways, I read through the docs and MUI suggests adding a few more properties in addition to the freeSolo prop.

https://material-ui.com/components/autocomplete/#creatable

If freeSolo={true} our component should add those ^ props as well.

We have 1 final design decision to make, I'm passing the below video to Nemeth for final direction.

https://www.loom.com/share/72bbab30fedf481abc9de4b3ce31e71a

Chris Nemeth approved Option 1 for Creating an item that doesn't exist in the list of dropdown options.
The example in the docs is "Free solo with text box"
https://material-ui.com/components/autocomplete/#creatable

@SeanGroff SeanGroff added enhancement New feature or request help wanted Extra attention is needed labels May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants