From 9524f4a239316fd298664534c20b84e6f82c7f4b Mon Sep 17 00:00:00 2001 From: Kaan Kacar Date: Thu, 30 Jul 2026 16:40:22 +0300 Subject: [PATCH] Wrap @theme-original/Root instead of replacing it docusaurus-markdown-source-plugin ships its own theme Root, which is what injects the Open Markdown dropdown and the hash-scroll behavior. The user-land Root added in #2698 shadowed it outright, removing the button site-wide. Wrapping the original Root keeps the plugin running and still mounts the For agents panel once above the router. Fixes #2712 --- src/theme/Root.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/theme/Root.tsx b/src/theme/Root.tsx index fe8e4146a..4109b1ec3 100644 --- a/src/theme/Root.tsx +++ b/src/theme/Root.tsx @@ -1,4 +1,5 @@ import React, { type ReactNode } from 'react'; +import Root from '@theme-original/Root'; import ForAgentsPanel from '@site/src/components/ForAgentsPanel'; @@ -10,12 +11,18 @@ interface Props { * `Root` wraps the whole app above the router, so anything rendered here * survives client-side navigation. That is what the "For agents" panel needs: * one instance for the entire site rather than one per page (#2586). + * + * This must WRAP `@theme-original/Root`, not replace it: + * `docusaurus-markdown-source-plugin` ships its own Root, which injects the + * "Open Markdown" dropdown and the hash-scroll behavior on docs pages. A + * user-land Root shadows it outright, which is exactly the regression that + * removed the button site-wide (#2712). */ -export default function Root({ children }: Props): ReactNode { +export default function RootWrapper({ children }: Props): ReactNode { return ( - <> + {children} - + ); }