From e96a5526005718c0cf34a8be1005e3bf1b1bd965 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 26 May 2026 20:53:35 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20sidebar=20hint=20=E2=80=94=20use=20st.ht?= =?UTF-8?q?ml(),=20fix=20premature=20dismiss=20on=20open=20sidebar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs fixed: 1. Deprecation warning: replace st.components.v1.html with st.html() (available since Streamlit 1.36). st.html() renders inline in the main window so scripts execute without an iframe; window.parent and the associated cross-origin complexity are no longer needed. 2. Arrow never appeared: the previous poll called sidebarIsOpen() every 400 ms and immediately set sbVisited='1' when the sidebar was already open on load, preventing the hint from ever showing. Fixed by introducing window._sbShowing: the poll only dismisses after the timer has actually made the hint visible. Also inverted the helper to sidebarIsClosed() (truthy = toggle button exists and is visible) to make the intent unambiguous. https://claude.ai/code/session_01VTBKKYLiAQ6mDPdmVhpRAT --- finance_tracker/web/app.py | 59 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/finance_tracker/web/app.py b/finance_tracker/web/app.py index db4a8af..8abbeca 100644 --- a/finance_tracker/web/app.py +++ b/finance_tracker/web/app.py @@ -13,7 +13,6 @@ import html as _html import json import streamlit as st -import streamlit.components.v1 as st_components import os from finance_tracker.web.db import get_session, get_db_path, get_engine from finance_tracker.web.navigation import build_pages @@ -120,25 +119,21 @@ def render_db_manager(): st.rerun() # Animated arrow hinting at the sidebar toggle after 20 s of inactivity. - # Uses st_components.html (iframe) so the script actually executes — - # st.markdown strips """, height=0) +""") # Show documentation (needs no DB) so users aren't stranded on a blank page from finance_tracker.web.views.documentation import render as doc_render