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

feat: Auto call onAddNew when the user searchs and there is no match #1070

Closed
wants to merge 1 commit into from

Conversation

JonnCharpentier
Copy link
Contributor

This change allow us to automatically switch to Add mode when the user search and there are not matches in the provided options

@JonnCharpentier JonnCharpentier changed the title SC-56770 Auto call onAddNew when the user searchs and there is no match feat: Auto call onAddNew when the user searchs and there is no match Sep 18, 2024
Comment on lines +315 to +318
useEffect(() => {
if (!debouncedSearch || !onAddNew) return;
if (filteredOptions.length === 1 && filteredOptions[0] === addNewOption) onAddNew(debouncedSearch);
}, [debouncedSearch, filteredOptions, onAddNew]);
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: This feels like we're assuming too much. It's possible the user has a typo, or just wants to see what options are available. They may not want to go straight to the Add New callback.
question: Is this coming from product feedback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree with you, feels too much. But also the user can hit ESC or the x icon to go back to select mode
This was an ask from Dave.

Copy link
Contributor

Choose a reason for hiding this comment

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

So if I have a typo, then I'll automatically move to the "Add new" text field. I'll try to hit backspace to fix my input, but then I'm no longer in the select field. As a user I'll have to understand that not matching anything in the list will automatically change my field. And then know that I can return to the list by the two methods you described.
I don't think that is going to be clear to our users.
I disagree with the purposed UX and I think it's going to make for a poor user experience. If this is really want Dave wants and thinks that it is the correct thing, then let's push it through.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll talk to Dave about it

Copy link
Contributor

@bdow bdow left a comment

Choose a reason for hiding this comment

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

🙈

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

Successfully merging this pull request may close these issues.

3 participants