streamlit / docs

Source code for the Streamlit Python library documentation
https://docs.streamlit.io
Apache License 2.0
110 stars 459 forks source link

Fix scroll padding, so headers don't appear behind the top bar when you navigate to a page via an #anchor. #1132

Closed sfc-gh-tteixeira closed 1 month ago

sfc-gh-tteixeira commented 1 month ago

📚 Context

When you click navigate to a page like https://docs.streamlit.io/develop/api-reference/utilities/st.context#contextcookies, which has a hash pointing to a specific part of the page (#contextcookies in this case), that part of the page gets partially obscured by the site's top bar. With this change, this no longer happens.

Compare the above with https://deploy-preview-1132--streamlit-docs.netlify.app/develop/api-reference/utilities/st.context#contextcookies! Here you'll the "context cookies" header is visible rather than hidden under the top bar.

🧠 Description of Changes

Fix the number used in scroll padding to match what we use for the top bar height.

💥 Impact

Size:

🌐 References

None

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

sfc-gh-dmatthews commented 1 month ago

@sfc-gh-tteixeira Thanks! This is another nit I can check off my list. Just FYI, this PR ends up adding excessive padding in other areas. I think it's still better than what it was since at least no header is hidden now, but we might be able to target the scroll padding a little more (or remove the original padding on the header elements so it's consistently from this one source). See preview vs current.