-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
feature:st.codeRelated to the `st.code` elementRelated to the `st.code` elementpriority:P1High priority - fix within two weeksHigh priority - fix within two weeksstatus: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
Please go to https://docs.streamlit.io/develop/api-reference/text/st.code to see the issue.
The code block will display:
as long as the code block is not in the viewport when page reload.
Reproducible Code Example
import streamlit as st
code = '''def hello():
print("Hello, Streamlit!")'''
st.code(code, language="python")Steps To Reproduce
- Go to https://docs.streamlit.io/develop/api-reference/text/st.code
- make sure the code block is not in the current viewport:
Expected Behavior
In Chrome, the browser remembers the scroll position, so just reload, and the code block will diplay correctly as it is in the viewport now.
Current Behavior
st.code is not displayed correctly if the code block is not in the viewport when the page loads.
It shows:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]the copy function is correct.
def hello():
print("Hello, Streamlit!")Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.41.1
- Python version:
- Operating System: Windows 10
- Browser: Chrome
Additional Information
No response
github-actions, dansleight and jrieke
Metadata
Metadata
Assignees
Labels
feature:st.codeRelated to the `st.code` elementRelated to the `st.code` elementpriority:P1High priority - fix within two weeksHigh priority - fix within two weeksstatus: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



