From 08a9b73bd2a505897555fa10a2b4c0043a55eb0b Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Wed, 22 Apr 2026 12:37:06 -0700 Subject: [PATCH] fix(Dashboard): attach visibilitychange listener to document The visibilitychange event is dispatched on document, not window, so listening on window prevented browser-tab hide/show logging from firing. --- superset-frontend/src/dashboard/components/Dashboard.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/dashboard/components/Dashboard.tsx b/superset-frontend/src/dashboard/components/Dashboard.tsx index 2135a98e442..f468ad3033e 100644 --- a/superset-frontend/src/dashboard/components/Dashboard.tsx +++ b/superset-frontend/src/dashboard/components/Dashboard.tsx @@ -296,11 +296,11 @@ function Dashboard({ ts: new Date().getTime(), }; } - window.addEventListener('visibilitychange', onVisibilityChange); + document.addEventListener('visibilitychange', onVisibilityChange); // componentWillUnmount equivalent return () => { - window.removeEventListener('visibilitychange', onVisibilityChange); + document.removeEventListener('visibilitychange', onVisibilityChange); onBeforeUnload(false); // Remove beforeunload listener on unmount actions.clearDataMaskState(); actions.clearAllChartStates();