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

st.multiselect with max_selections argument does not return "No Results" when search does not match any option, but shows the max selection message #7116

Closed
3 of 4 tasks
smc395 opened this issue Aug 4, 2023 · 1 comment · Fixed by #7205
Assignees
Labels
feature:st.multiselect priority:P2 status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working

Comments

@smc395
Copy link

smc395 commented Aug 4, 2023

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

When searching in a multiselect widget and the search does not match any of the available options, the dropdown continues to show "You can only select up to N options. Remove an option first." This behavior is inconsistent with the selectbox widget's functionality when the search has no matching options and causes confusion for end users who are searching for an option, but instead are told to remove options.

Reproducible Code Example

import streamlit as st

selection = st.multiselect(label='Multiselect Issue', options=['Cat', 'Mouse', 'Dog'], max_selections=1)

Steps To Reproduce

Scenario 1 - no selected options were made yet

  1. Create a streamlit multiselect widget with the max_selections argument set to value of 1 (however this applies to other integer values above zero)
  2. Start typing into the widget something like "zzzzzz" where it is not an option that would match the search
  3. You should see "You can only select up to N options. Remove an option first." in the dropdown

Scenario 2 - selected options are less than the max_selections argument

  1. Create a streamlit multiselect widget with the max_selections argument set to value of 2 (however this applies to other integer values above zero)
  2. Select a valid option in the multiselect
  3. Start typing into the widget something like "zzzzzz" where it is not an option that would match the search
  4. You should see "You can only select up to N options. Remove an option first." in the dropdown

Expected Behavior

When no selections are made in the multiselect widget, I expect the dropdown to show "No Results" when searching, and no search matches occur.

When options are selected in the multiselect widget, but less than max_selections, I expect the dropdown to show "No Results" when searching, and no search matches occur.

When the person has selected the number of options equal to the max_selections argument, I expect the dropdown to show "You can only select up to N options. Remove an option first." and not be able to search in the multiselect widget.

Current Behavior

Scenario 1

multiselect_no_results_bug

Scenario 2

multiselect_no_results_bug2

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.24.0
  • Python version: 3.10.12
  • Operating System: macOS Ventura 13.4.1 (c) (22F770820d)
  • Browser: Chrome Version 115.0.5790.114 (Official Build) (arm64)

Additional Information

Maybe related to these pull requests

@smc395 smc395 added status:needs-triage Has not been triaged by the Streamlit team type:bug Something isn't working labels Aug 4, 2023
@kajarenc
Copy link
Collaborator

kajarenc commented Aug 4, 2023

Hey, @smc395 !
thank you very much for opening this issue

I was able to reproduce this issue here https://issues.streamlit.app/?issue=gh-7116 and I can confirm that this is a bug.

@kajarenc kajarenc added status:confirmed Bug has been confirmed by the Streamlit team priority:P2 feature:st.multiselect and removed status:needs-triage Has not been triaged by the Streamlit team labels Aug 4, 2023
@sfc-gh-mbarnes sfc-gh-mbarnes added feature:st.file_uploader and removed status:confirmed Bug has been confirmed by the Streamlit team feature:st.multiselect labels Aug 8, 2023
@mayagbarnes mayagbarnes added status:confirmed Bug has been confirmed by the Streamlit team feature:st.multiselect and removed feature:st.file_uploader labels Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:st.multiselect priority:P2 status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants