-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Selectbox Search Returning Unexpected Results #1010
Description
Summary
I’m working with the select box and I noticed that, when I start typing to help narrow down the search window, it returns results that I am not expecting.
Steps to reproduce
What are the steps we should take to reproduce the bug:
- Run the following streamlit code.
import streamlit as st; st.selectbox('Example', ['None'] + [i for i in range(20)]); - In the selectbox, type "8".
Expected behavior:
Searching "8" should only return results "8" and "18", as they contain the character "8" in them.
Actual behavior:
The results "7", "8", "17", and "18" are returned.
I believe that the underlying search function is also returning results whose index has an "8" in it. After all, because we padded the initial selectbox with "None", the values of "7" and "17" are actually at indices "8" and "18".
Typing "0" seems to confirm my suspicions, as "None" is returned (it's at index 0) along with "0" (as expected), "9" (which is index 10), "10" (as expected), and "19" (which is index 20).
Is this a regression?
No idea. I have only ever used streamlit 0.53.0
Debug info
- Streamlit version: (get it with
$ streamlit version): 0.53.0 - Python version: (get it with
$ python --version): 3.7.4 - Using Conda? PipEnv? PyEnv? Pex?: Conda
- OS version: Windows 10 Pro 64-bit
- Browser version: Chrome Version 79.0.3945.130 (Official Build) (64-bit)
Additional information
See discussion here: https://discuss.streamlit.io/t/bug-w-searching-in-selectbox/1717