+
+
+ {addons &&
{addons}
}
+
+ {items.map(({ tab, tabId, isDefault, panel }) => (
+
+ {panel}
+
+ ))}
+
+ );
+};
export default CodeTabs;
diff --git a/packages/ui-components/src/Common/CodeTabs/useCodeTabNavigation.ts b/packages/ui-components/src/Common/CodeTabs/useCodeTabNavigation.ts
new file mode 100644
index 0000000000000..932a10ae5f05c
--- /dev/null
+++ b/packages/ui-components/src/Common/CodeTabs/useCodeTabNavigation.ts
@@ -0,0 +1,59 @@
+import { useRef, useSyncExternalStore } from 'react';
+
+import type { KeyboardEvent, MouseEvent } from 'react';
+
+const subscribe = (onChange: () => void) => {
+ window.addEventListener('hashchange', onChange);
+ return () => window.removeEventListener('hashchange', onChange);
+};
+
+const getSnapshot = () => window.location.hash;
+const getServerSnapshot = () => null;
+
+// CSS owns visibility. This enhancement keeps ARIA and keyboard navigation
+// aligned with the URL, including browser Back/Forward and external links.
+export function useCodeTabNavigation(ids: Array