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

Autocomplete: hide popup on zero suggestions #2873

Open
MatthiasvB opened this issue Oct 11, 2024 · 4 comments
Open

Autocomplete: hide popup on zero suggestions #2873

MatthiasvB opened this issue Oct 11, 2024 · 4 comments
Labels
feature request Request a feature or introduce and update to the project.

Comments

@MatthiasvB
Copy link

Describe the feature in detail (code, mocks, or screenshots encouraged)

Currently, the emptyState prop allows us to pass in some HTML to be displayed when no search results match. However, there are usecases where one may not only let the user choose between predefined options but also to provide custom content. In this case, it is annoying to still see "No Results found" or any similar content. I would want the autocomplete popup to simply disappear.

This could be implemented using a simple boolean flag hideOnNoSuggestions or, possibly allowing for even greater flexibility, by providing access to the currently available suggestions, allowing the developer to add custom styling (such as display: none).

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

No response

@MatthiasvB MatthiasvB added the feature request Request a feature or introduce and update to the project. label Oct 11, 2024
@phamduylong
Copy link
Contributor

Never used the Autocomplete component before, but isn't regionEmpty prop used for this? I think this could work for your purpose:

<Autocomplete regionEmpty="hidden" />

@endigo9740
Copy link
Contributor

Never used the Autocomplete component before, but isn't regionEmpty prop used for this? I think this could work for your purpose:

<Autocomplete regionEmpty="hidden" />

Unfortunately no, that's a "style prop" intended for accepting utility class styles for the empty region of the template.

@phamduylong
Copy link
Contributor

Never used the Autocomplete component before, but isn't regionEmpty prop used for this? I think this could work for your purpose:

<Autocomplete regionEmpty="hidden" />

Unfortunately no, that's a "style prop" intended for accepting utility class styles for the empty region of the template.

Isee. A flag like hideOnNoSuggestions should be simple enough. If this is an acceptable solution, can you assign it to me? I'll throw a PR ASAP.

@endigo9740
Copy link
Contributor

@phamduylong thanks for volunteering. I'm currently out of office today, but let me circle back to this one first. My gut is telling me a wrapping conditional might accomplish what's being asked here. Though I can understand the desire to handle it within the component too. If we go forward with the latter I'll ping you and assign the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request a feature or introduce and update to the project.
Projects
None yet
Development

No branches or pull requests

3 participants