-
Notifications
You must be signed in to change notification settings - Fork 4.2k
st.data_editor() input is overwritten during editing, when other Streamlit elements within st.empty() is updated #7831
Copy link
Copy link
Closed
Labels
feature:st.data_editorRelated to the `st.data_editor` widgetRelated to the `st.data_editor` widgetpriority:P2Medium-high priority - fix within one monthMedium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected
Description
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 st.data_editor() is utilized on a page alongside with other widgets which are updated in the background, e.g. in a cyclical fashion (see example), editing of cell content is close to impossible:
While typing in new characters, the select all editing mode is entered automatically (all characters highlighted with light blue background) whenever another element on the page (residing in an st.empty() element) is updated.
Thus, upon input of the next character all prior input is overwritten.
This issue does not apply to e.g. st.number_input() but seems to be limited to st.data_editor().
Reproducible Code Example
import streamlit as st
import pandas as pd
import time
def main():
text_container = st.empty()
with text_container:
st.write("Hello")
st.data_editor(pd.DataFrame({"Key": ["My Property"], "Value": ["42.0"]}, dtype="string"),
column_config={"Key": st.column_config.TextColumn(),
"Value": st.column_config.TextColumn()},
num_rows="dynamic", hide_index=True, use_container_width=True)
index = 1
while(True):
text_container.empty()
with text_container:
st.write(f"Hello {index}")
index += 1
time.sleep(1)
if __name__ == '__main__':
main()Steps To Reproduce
- run the example
- select a cell of the data-editor (e.g. the cell with number 42.0)
- start providing new input by typing in a new number (e.g. 3.141592653)
- character input will be highlighted (every second) and overwritten on next character input
Expected Behavior
Editing shall not be influenced by updating other widgets in background..
Current Behavior
No response
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.29
- Python version: 3.11.5
- Operating System: Mac OSX 13.5.1
- Browser: many
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature:st.data_editorRelated to the `st.data_editor` widgetRelated to the `st.data_editor` widgetpriority:P2Medium-high priority - fix within one monthMedium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected