From dc845698f15817ebffce5a8b5eb7e0148e7379d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 26 May 2026 20:41:53 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20sidebar=20hint=20=E2=80=94=20correct=20t?= =?UTF-8?q?ext=20and=20auto-dismiss=20on=20sidebar=20open?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs fixed: 1. Wrong text ("app.sidebar_hint" key instead of translation): The innerHTML was built by JS string concatenation which broke when hint_label was injected. Now the full innerHTML is assembled in Python (where t() is guaranteed to work) and passed as a single JSON string: h.innerHTML = . 2. Arrow not dismissing on sidebar open: The setTimeout/setInterval were scoped to the iframe which Streamlit destroys on each re-render, losing the event listeners. Fixed by storing timers on window.parent (_sbTimer, _sbPoll) so they survive re-renders. Sidebar state is now detected by polling for the collapsed-control button disappearing rather than relying on a click event that could be missed. https://claude.ai/code/session_01VTBKKYLiAQ6mDPdmVhpRAT --- finance_tracker/web/app.py | 47 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/finance_tracker/web/app.py b/finance_tracker/web/app.py index b251b4c..db4a8af 100644 --- a/finance_tracker/web/app.py +++ b/finance_tracker/web/app.py @@ -10,6 +10,7 @@ support for SCPIs, cryptocurrencies like Bitcoin, savings accounts, and other financial assets. """ +import html as _html import json import streamlit as st import streamlit.components.v1 as st_components @@ -122,13 +123,20 @@ def render_db_manager(): # Uses st_components.html (iframe) so the script actually executes — # st.markdown strips """, height=0)