diff --git a/src/gui/components/_legacy.py b/src/gui/components/_legacy.py index 88b81e1..18e5401 100644 --- a/src/gui/components/_legacy.py +++ b/src/gui/components/_legacy.py @@ -734,9 +734,15 @@ def render_sticky_footer() -> None: Streamlit's soft nav (preserves the websocket, no visible page reload) instead of the browser hard-nav an ```` would trigger. Off-screen (rather than ``display:none``) so - React event delegation works reliably across browsers. */ -[data-testid="stElementContainer"]:has(a[data-testid="stPageLink"][href$="/close"]), -[data-testid="stElementContainer"]:has(a[data-testid="stPageLink"][href$="/close/"]) { + React event delegation works reliably across browsers. + + NOTE on the selector: Streamlit's page_link renders an outer + wrapper div with ``data-testid="stPageLink"`` and an inner anchor + with ``data-testid="stPageLink-NavLink"`` — the NavLink suffix + is required to match the anchor (the bare testid is on the + wrapper). ``href*="close"`` works across both root (``/close``) + and base-path (``/myapp/close``) deployments. */ +[data-testid="stElementContainer"]:has(a[data-testid="stPageLink-NavLink"][href*="close"]) { position: absolute !important; left: -9999px !important; top: -9999px !important; @@ -747,9 +753,9 @@ def render_sticky_footer() -> None: pointer-events: none !important; } /* Defensive fallback for browsers without :has() — at least - shrink the inline page_link so it doesn't render a visible row. */ -a[data-testid="stPageLink"][href$="/close"], -a[data-testid="stPageLink"][href$="/close/"] { + shrink the inline page_link so it doesn't render a visible row. + Same testid note as above. */ +a[data-testid="stPageLink-NavLink"][href*="close"] { visibility: hidden !important; height: 0 !important; padding: 0 !important;