From d7ae4f2e3ccdbdbb1a7cb6be660713aae44a6713 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" <219766164+opencode-agent[bot]@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:56:00 +0100 Subject: [PATCH] fix(site): keep the page when leaving the Markdown view on static pages (#63503) Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> --- services/site/src/client/overlays/markdown.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/site/src/client/overlays/markdown.tsx b/services/site/src/client/overlays/markdown.tsx index 79e843a81df..41426fe0859 100644 --- a/services/site/src/client/overlays/markdown.tsx +++ b/services/site/src/client/overlays/markdown.tsx @@ -36,10 +36,18 @@ export async function toggle(on = !dispose, fromFooter = false) { if (text === undefined || dispose) return const file = href()!.split("/").pop()! const home = $('[data-slot="logo"]')?.getAttribute("href") ?? "/" - dispose = await mount( + // Its own host after the page: disposing a render empties its host, which must not take the page. + const host = document.createElement("div") + host.style.display = "contents" + $('[data-component="content"]')!.append(host) + const unmount = await mount( () => void toggle(false)} />, - $('[data-component="content"]')!, + host, ) + dispose = () => { + unmount() + host.remove() + } sessionStorage.setItem(markdownKey, "1") show(true, fromFooter) }