Checklist
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:

- Scroll down to see what's going on.

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?
Debug info
- Streamlit version: 1.41.1
- Python version:
- Operating System: Windows 10
- Browser: Chrome
Additional Information
No response
Checklist
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
Steps To Reproduce
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.codeis not displayed correctly if the code block is not in the viewport when the page loads.It shows:
the copy function is correct.
Is this a regression?
Debug info
Additional Information
No response