This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 707a390abbf4af2e4a5e8a3fa7bcbc8b2d5984af
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Dec 4 15:25:49 2025 +0100

    [v3-1-test] Fix go back button from fab iframe (#58997) (#59007)
    
    (cherry picked from commit ab8820e2d71e11ef870dc6729d49ab5f9345a506)
    
    Co-authored-by: Pierre Jeambrun <[email protected]>
---
 airflow-core/src/airflow/ui/src/pages/Security.tsx | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/ui/src/pages/Security.tsx 
b/airflow-core/src/airflow/ui/src/pages/Security.tsx
index ab9941fc02a..67aefc1dd7a 100644
--- a/airflow-core/src/airflow/ui/src/pages/Security.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Security.tsx
@@ -18,6 +18,7 @@
  */
 import { Box } from "@chakra-ui/react";
 import { useParams } from "react-router-dom";
+import { useNavigate } from "react-router-dom";
 
 import { useAuthLinksServiceGetAuthMenus } from "openapi/queries";
 import { ProgressBar } from "src/components/ui";
@@ -37,6 +38,16 @@ export const Security = () => {
 
   const link = authLinks?.extra_menu_items.find((mi) => 
mi.text.toLowerCase().replace(" ", "-") === page);
 
+  const navigate = useNavigate();
+
+  const onLoad = () => {
+    const iframe: HTMLIFrameElement | null = 
document.querySelector("#security-iframe");
+
+    if (iframe?.contentWindow && 
!iframe.contentWindow.location.pathname.startsWith("/auth/")) {
+      navigate("/");
+    }
+  };
+
   if (!link) {
     if (isLoading) {
       return (
@@ -51,7 +62,17 @@ export const Security = () => {
 
   return (
     <Box flexGrow={1} m={-3}>
-      <iframe sandbox={SANDBOX} src={link.href} style={{ height: "100%", 
width: "100%" }} title={link.text} />
+      {
+        // eslint-disable-next-line 
jsx-a11y/no-noninteractive-element-interactions
+        <iframe
+          id="security-iframe"
+          onLoad={onLoad}
+          sandbox={SANDBOX}
+          src={link.href}
+          style={{ height: "100%", width: "100%" }}
+          title={link.text}
+        />
+      }
     </Box>
   );
 };

Reply via email to