With this specific layout when I try to move from one text_input to another by clicking on the second one I canāt directly type as the cursor ādisablesā. In order to type in the second one I need to click again in it to āenableā the cursor.
Steps to reproduce
Code snippet:
import streamlit as st
tab1, tab2 = st.tabs(["TAB1", "TAB2"])
with tab1:
col1, col2 = st.columns([3,3])
with col1:
text1 = st.text_input('Insert text')
with col2:
text2 = st.text_input('Insert another text')
Expected behavior:
The other text_input should be possible to input text without clicking on it again to move the cursor inside
Actual behavior:
No error message is given. The cursor seems to move correctly in the second text_input but then it focuses out and itās impossible to type in the field unless you click again inside it. Same behaviour when using Tab key to move between text_inputs
Debug info
Streamlit version: tried with 1.27.2, 1.27.1, 1.27.0
Python version: 3.11.5
Using pipenv
OS version: Arch Linux (Intel 64 bit)- systemd 254 (254.5-1-arch)
Browser version: FIrefox 118.0.1, Chromium 117.0.5938.149 (same error on both)
The error seems to appear only on the first run of the app or on refresh. It doesnāt always happen. It seems like it only gives the issue when using this particular streamlit layout (multiple text_inputs nested inside columns inside tabs)
Just to make sure that we understand the problem that youāre facing, which is, a single click on a second text_input does not allow you to enter text (as there are no cursor) but it requires two clicks to activate the cursor in the second text_input?
Also, could you share a link or GitHub repo of your app so that the community can use this in devising possible solutions?
Hereās a video of the current behaviour, as you can see (I hope) when I click on the second text_input the cursor moves in the text field but then rapdily disappears, in order to start typing again I have to reselect the text_input. That happens also when the text_input is already filled.
[My first post, so sorry if itās rough or misplaced.]
Iām having similar problems with number_input fields in a tab layout. There seems to be a change in focus behavior when you surround input fields in a tab layout, e.g. between:
st.number_input("A")
st.number_input("B")
and
with st.tabs(["Tab"])[0]:
st.number_input("A")
st.number_input("B")
In the first case, you can type a number in āAā, hit tab, and immediately enter a number in āBā. In the second case (with the tab layout) tabbing moves the focus visually, but you canāt actually enter a number (i.e. the keyboard focus hasnāt actually moved). I found the workaround is to type a number in field A and then hit return before hitting tab. Doing this properly moves the focus to B in a tab layout.
Update: I reverted to v1.26 of streamlit and the problem went away. So that is my workaround for now and an indication of where the problem lies.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking āAccept allā, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.