Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c2ec499
chore(deps): upgrade Fumadocs to 16.17.9
nickvigilante Nov 2, 2026
cafd18d
chore: drop collapsed-sidebar CSS and refresh version notes after the…
nickvigilante Nov 2, 2026
18939cf
ci(.github): empty the axe allowlist
nickvigilante Nov 2, 2026
560d004
fix(docs-transforms): keep gate text and tags out of search records
nickvigilante Nov 2, 2026
f0df0ad
Merge origin/main into vigilante/fumadocs-16-17-upgrade
nickvigilante Nov 5, 2026
efc1bb3
chore: merge main and regenerate pnpm-lock.yaml
coder[bot] Nov 16, 2026
654403f
chore: merge main and regenerate pnpm-lock.yaml
nickvigilante Nov 17, 2026
4a90ee1
fix(docs-transforms): blank a hidden Experimental body after its nest…
nickvigilante Nov 17, 2026
b55d87c
fix(docs-transforms): refuse to default replaceSource across fumadocs…
nickvigilante Nov 17, 2026
aafd24e
fix(docs): normalise DOCS_BASE_PATH before the MDX pipeline gets it
nickvigilante Nov 17, 2026
7d71f40
fix(docs-next): show Search failed when the search index cannot be fe…
nickvigilante Nov 17, 2026
bcdf300
fix(docs-next): drop a table record's delimiter row by position
nickvigilante Nov 17, 2026
8e74daa
docs: name fumadocs-ui 16.17.9 in the fork notes it was checked against
nickvigilante Nov 17, 2026
d732311
refactor(docs-transforms): build both callout markers from one alert …
nickvigilante Nov 17, 2026
540a935
test: compile the e2e pipelines with their own package's replaceSource
nickvigilante Nov 17, 2026
b9cb337
fix(docs-transforms): require this package's own remarkHeading unless…
nickvigilante Nov 18, 2026
d09b18b
Merge remote-tracking branch 'origin/main' into vigilante/fumadocs-16…
nickvigilante Nov 18, 2026
1a662f3
build(deps): upgrade Fumadocs to fumadocs-core and fumadocs-ui 16.19.…
nickvigilante Nov 18, 2026
3e8ae5f
fix(docs-theme): keep only our skip link in the focus order
nickvigilante Nov 18, 2026
e01cd7b
refactor(docs-next): render the sidebar's aria-current instead of add…
nickvigilante Nov 18, 2026
7b564e2
Merge remote-tracking branch 'origin/main' into vigilante/fumadocs-16…
nickvigilante Nov 18, 2026
3a3c82c
build(deps): share one Radix tabs range with fumadocs-ui
nickvigilante Nov 19, 2026
13d532a
Merge remote-tracking branch 'origin/main' into vigilante/fumadocs-16…
nickvigilante Nov 19, 2026
cf235f0
docs: name fumadocs-ui 16.19.0 in the copy button's fork note
nickvigilante Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/docs-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"devDependencies": {
"@coder/docs-transforms": "workspace:*",
"@mdx-js/mdx": "3.1.1",
"@radix-ui/react-tabs": "catalog:",
"@types/mdx": "2.0.14",
"fumadocs-mdx": "catalog:",
"@types/node": "^24",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-next/src/copy-markdown-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const cache = new Map<string, string>();
* Copies the page's markdown twin to the clipboard, fetching `markdownUrl`
* exactly as given.
*/
// Fork of fumadocs-ui 16.17.9 MarkdownCopyButton (layouts/shared/page-actions.tsx) without its BASE_URL prefix.
// Fork of fumadocs-ui 16.19.0 MarkdownCopyButton (layouts/shared/page-actions.tsx) without its BASE_URL prefix.
export function CopyMarkdownButton({
markdownUrl,
}: {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-next/src/search-markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function remarkInertHtml() {
}

// Mirrors the element styling of fumadocs-ui's search dialog markdown
// components (dialog/search.js, 16.17.9), minus raw-HTML and custom elements.
// components (dialog/search.js, 16.19.0), minus raw-HTML and custom elements.
const components = {
a: "span",
img: () => null,
Expand Down
35 changes: 35 additions & 0 deletions packages/docs-next/src/shell.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import { fileURLToPath } from "node:url";
import { flattenTree } from "fumadocs-core/page-tree";
import { loader } from "fumadocs-core/source";
import { useTreeContext } from "fumadocs-ui/contexts/tree";
import { renderToStaticMarkup } from "react-dom/server";
import { renderToFragment } from "../test/dom.js";
import { docsSource, pageFile, renderInShell } from "../test/source.js";
import { DocsArticle } from "./article.js";
Expand Down Expand Up @@ -157,6 +160,38 @@ test("the first thing in the shell is a skip link to the article, ahead of the b
assert.equal(article.hasAttribute("tabindex"), false);
});

test("ours is the only skip link a keyboard reaches; the theme removes fumadocs-ui's", () => {
const container = document.createElement("div");
container.innerHTML = renderToStaticMarkup(
<DocsShell source={source}>
<DocsArticle page={{ title: "Overview", toc: [] }} markdownUrl="/index.md">
{content}
</DocsArticle>
</DocsShell>,
);
// jsdom can't parse the whole Tailwind sheet, so apply the theme's own rule on its own.
const css = readFileSync(
fileURLToPath(new URL("../../docs-theme/src/index.css", import.meta.url)),
"utf8",
);
const start = css.indexOf('a.sr-only[href="#nd-page"]');
const style = document.createElement("style");
style.textContent = start === -1 ? "" : css.slice(start, css.indexOf("}", start) + 1);
document.head.append(style);
document.body.append(container);
try {
const skipLinks = [...container.querySelectorAll<HTMLAnchorElement>('a[href="#nd-page"]')];
const reachable = skipLinks.filter((a) => getComputedStyle(a).display !== "none");
assert.deepEqual(
reachable.map((a) => a.className),
["docs-skip-link"],
);
} finally {
container.remove();
style.remove();
}
});

test("prepareSkipTarget gives the article a temporary tabindex, removed again on blur", () => {
const doc = new DOMParser().parseFromString(
'<html><body><article id="nd-page">content</article></body></html>',
Expand Down
23 changes: 23 additions & 0 deletions packages/docs-next/src/sidebar-folder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { loader } from "fumadocs-core/source";
import { SidebarProvider } from "fumadocs-ui/components/sidebar/base";
import { act } from "react";
import { type Root, createRoot } from "react-dom/client";
import { renderToStaticMarkup } from "react-dom/server";
import { pageFile } from "../test/source.js";
import { DocsShell } from "./shell.js";
import { SidebarFolder } from "./sidebar-folder.js";
Expand Down Expand Up @@ -243,3 +244,25 @@ test("only folders with children get a toggle and expandable content", async ()
["/admin/users", "/admin/external-auth"],
);
});

test("the server-rendered folder link is the current page only on its own page", () => {
const html = (pathname: string) => {
const container = document.createElement("div");
container.innerHTML = renderToStaticMarkup(
<FrameworkProvider
usePathname={() => pathname}
useRouter={() => ({ push() {}, refresh() {} })}
useParams={() => ({})}
>
<SidebarProvider>
<SidebarFolder item={withPage}>
<a href="/child">child</a>
</SidebarFolder>
</SidebarProvider>
</FrameworkProvider>,
);
return container.querySelector("a[data-folder-link]");
};
assert.equal(html("/admin")?.getAttribute("aria-current"), "page");
assert.equal(html("/admin/users")?.hasAttribute("aria-current"), false);
});
3 changes: 2 additions & 1 deletion packages/docs-next/src/sidebar-folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CollapsibleTrigger } from "fumadocs-ui/components/ui/collapsible";
import { useTreePath } from "fumadocs-ui/contexts/tree";
import { type ReactNode, useRef } from "react";

// Adapted from fumadocs-ui 16.17.9 dist/layouts/docs/slots/sidebar.js (SidebarFolder*, SidebarItem).
// Adapted from fumadocs-ui 16.19.0 dist/layouts/docs/slots/sidebar.js (SidebarFolder*, SidebarItem).
const itemClass =
"relative flex flex-row items-center gap-2 p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0";
const pageLinkClass =
Expand Down Expand Up @@ -64,6 +64,7 @@ function SplitRow({ item }: { item: PageTree.Folder & { index: PageTree.Item } }
external={item.index.external}
prefetch={prefetch}
data-active={active}
aria-current={active ? "page" : undefined}
data-folder-link=""
// The page may already be open, so navigating alone would not reopen a collapsed section.
onClick={() => folder?.setOpen(true)}
Expand Down
51 changes: 28 additions & 23 deletions packages/docs-next/src/sidebar-landmarks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import test from "node:test";
import { type MetaData, type VirtualFile, loader } from "fumadocs-core/source";
import { type ReactNode, act } from "react";
import { createRoot } from "react-dom/client";
import { renderToFragment } from "../test/dom.js";
import { DocsArticle } from "./article.js";
import { DocsShell } from "./shell.js";
import { SIDEBAR_NAV_LABEL, markSidebars } from "./sidebar-landmarks.js";
Expand Down Expand Up @@ -54,19 +55,20 @@ test("exactly one sidebar link is the current page: the one Fumadocs highlights"
await unmount();
});

test("aria-current follows the highlight when it moves", async () => {
const { mount, unmount } = await mountShell();
const home = mount.querySelector("#nd-sidebar a[href='/']");
const admin = mount.querySelector("#nd-sidebar a[href='/admin']");
home?.setAttribute("data-active", "false");
admin?.setAttribute("data-active", "true");
await flush();
assert.equal(home?.hasAttribute("aria-current"), false);
assert.equal(admin?.getAttribute("aria-current"), "page");
await unmount();
test("the current page is marked in the server-rendered HTML, before any script runs", () => {
const html = renderToFragment(
<DocsShell source={source}>
<p>page content</p>
</DocsShell>,
);
const current = html.querySelectorAll("#nd-sidebar [aria-current]");
assert.deepEqual(
[...current].map((a) => [a.getAttribute("href"), a.getAttribute("aria-current")]),
[["/", "page"]],
);
});

test("the mobile drawer's copy of the tree is marked the same way when it mounts", async () => {
test("the mobile drawer's copy of the tree becomes a landmark when it mounts", async () => {
const { mount, unmount } = await mountShell();
const drawer = document.createElement("aside");
drawer.id = "nd-sidebar-mobile";
Expand All @@ -79,21 +81,23 @@ test("the mobile drawer's copy of the tree is marked the same way when it mounts
await flush();
const nav = drawer.querySelector("[role='navigation']");
assert.equal(nav?.getAttribute("aria-label"), SIDEBAR_NAV_LABEL);
assert.deepEqual(
[...drawer.querySelectorAll("[aria-current='page']")].map((a) => a.getAttribute("href")),
["/"],
);
await unmount();
});

test("markSidebars leaves links outside the sidebars alone", () => {
// marker
test("markSidebars adds only the landmark, inside the sidebars only", () => {
document.body.innerHTML = `
<aside id="nd-sidebar"><div data-radix-scroll-area-viewport=""><a data-active="true" href="/">Home</a></div></aside>
<nav id="nd-toc"><a data-active="true" href="#install">Install</a></nav>`;
<nav id="nd-toc"><div data-radix-scroll-area-viewport=""><a data-active="true" href="#install">Install</a></div></nav>`;
markSidebars(document);
assert.equal(document.querySelector("#nd-toc a")?.hasAttribute("aria-current"), false);
assert.equal(document.querySelector("#nd-sidebar a")?.getAttribute("aria-current"), "page");
assert.equal(
document.querySelector("#nd-sidebar [data-radix-scroll-area-viewport]")?.getAttribute("role"),
"navigation",
);
assert.equal(
document.querySelector("#nd-toc [data-radix-scroll-area-viewport]")?.hasAttribute("role"),
false,
);
assert.equal(document.querySelector("[aria-current]"), null);
});

test("the observer only rescans the sidebars for a mutation that could have changed one", async () => {
Expand Down Expand Up @@ -121,10 +125,11 @@ test("the observer only rescans the sidebars for a mutation that could have chan
await flush();
assert.equal(rescans, 0, "the TOC's own data-active change should not rescan the sidebars");

const sidebarLink = mount.querySelector("#nd-sidebar a[data-active]");
sidebarLink?.setAttribute("data-active", "false");
const drawer = document.createElement("aside");
drawer.id = "nd-sidebar-mobile";
mount.append(drawer);
await flush();
assert.ok(rescans > 0, "a data-active change inside the sidebar should still rescan");
assert.ok(rescans > 0, "the drawer mounting should still rescan");
} finally {
document.querySelectorAll = originalQuerySelectorAll;
await unmount();
Expand Down
32 changes: 9 additions & 23 deletions packages/docs-next/src/sidebar-landmarks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,37 @@ const SIDEBARS = "#nd-sidebar, #nd-sidebar-mobile";

export const SIDEBAR_NAV_LABEL = "Documentation";

/** Makes each sidebar's page tree a navigation landmark and its `data-active` link the current page. */
/** Makes each sidebar's page tree a navigation landmark; the links render their own `aria-current`. */
export function markSidebars(root: ParentNode): void {
for (const sidebar of root.querySelectorAll(SIDEBARS)) {
const tree = sidebar.querySelector("[data-radix-scroll-area-viewport]");
if (tree && tree.getAttribute("role") !== "navigation") {
tree.setAttribute("role", "navigation");
tree.setAttribute("aria-label", SIDEBAR_NAV_LABEL);
}
for (const link of sidebar.querySelectorAll("a[data-active]")) {
if (link.getAttribute("data-active") === "true") link.setAttribute("aria-current", "page");
else link.removeAttribute("aria-current");
}
}
}

// fumadocs-ui 16.17.9 `layouts/docs/slots/sidebar.tsx` has no prop or slot for these, so they go on its DOM.
// fumadocs-ui 16.19.0 `layouts/docs/slots/sidebar.tsx` has no prop or slot for the landmark, so it goes on its DOM.
export function SidebarLandmarks(): null {
useEffect(() => {
markSidebars(document);
const observer = new MutationObserver((records) => {
if (records.some(touchesSidebar)) markSidebars(document);
});
observer.observe(document.body, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ["data-active"],
if (records.some(addsSidebar)) markSidebars(document);
});
observer.observe(document.body, { subtree: true, childList: true });
return () => observer.disconnect();
}, []);
return null;
}

/**
* Whether a mutation record could have changed a sidebar: an attribute change
* on a node inside one, or a node added that is or holds one (the drawer's
* lazy mount). Filters out the far more common unrelated mutations the
* observer's broad `document.body` subtree also sees: search-dialog results,
* copy-button icon swaps, and the TOC's own `data-active` highlight, which
* would otherwise rescan both sidebar trees on every one of them.
* Whether a mutation record added a node that is or holds a sidebar (the
* drawer's lazy mount). Filters out the far more common unrelated mutations
* the observer's broad `document.body` subtree also sees, such as
* search-dialog results and copy-button icon swaps.
*/
function touchesSidebar(record: MutationRecord): boolean {
if (record.type === "attributes") {
return record.target instanceof Element && record.target.closest(SIDEBARS) !== null;
}
function addsSidebar(record: MutationRecord): boolean {
for (const node of record.addedNodes) {
if (!(node instanceof Element)) continue;
if (node.matches(SIDEBARS) || node.querySelector(SIDEBARS)) return true;
Expand Down
4 changes: 3 additions & 1 deletion packages/docs-next/src/user-content-anchors.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import assert from "node:assert/strict";
import { afterEach, beforeEach, test } from "node:test";
import { FrameworkProvider } from "fumadocs-core/framework";
import { TabsContent, TabsList, TabsTrigger } from "fumadocs-ui/components/tabs";
// The panel docs-ui's TabSet renders: fumadocs-ui's own keeps `id` off the element.
import { TabsContent } from "@radix-ui/react-tabs";
import { TabsList, TabsTrigger } from "fumadocs-ui/components/tabs";
import { Tabs as TabsRoot } from "fumadocs-ui/components/tabs.unstyled";
import { type ReactNode, act, useState } from "react";
import { type Root, createRoot } from "react-dom/client";
Expand Down
5 changes: 5 additions & 0 deletions packages/docs-theme/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ a.docs-state-pill:focus-visible {
font-weight: 500;
}

/* fumadocs-ui 16.19.0's own skip link stays invisible when focused; ours replaces it. */
a.sr-only[href="#nd-page"] {
display: none;
}

.docs-skip-link:not(:focus) {
width: 1px;
height: 1px;
Expand Down
1 change: 1 addition & 0 deletions packages/docs-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@coder/docs-config": "workspace:*",
"@coder/docs-manifest": "workspace:*",
"@phosphor-icons/react": "2.1.10",
"@radix-ui/react-tabs": "catalog:",
"fumadocs-core": "catalog:",
"fumadocs-ui": "catalog:"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-ui/src/scroll-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function regionName(wrapper: HTMLElement, captionId: string): RegionName {
return { "aria-label": names.get(wrapper) ?? "Table" };
}

// Unlike fumadocs-ui 16.17.9's `Table` (src/mdx.tsx), a named tab stop only when it overflows.
// Unlike fumadocs-ui 16.19.0's `Table` (src/mdx.tsx), a named tab stop only when it overflows.
export function ScrollTable(props: TableHTMLAttributes<HTMLTableElement>) {
const ref = useRef<HTMLDivElement>(null);
const captionId = useId();
Expand Down
12 changes: 12 additions & 0 deletions packages/docs-ui/src/tabs.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import assert from "node:assert/strict";
import { realpathSync } from "node:fs";
import { createRequire } from "node:module";
import { afterEach, beforeEach, test } from "node:test";
import { act } from "react";
import { type Root, createRoot } from "react-dom/client";
Expand Down Expand Up @@ -189,3 +191,13 @@ test("OSTab opens the tab a hash names over the detected OS", async () => {
await renderOS();
assert.equal(activePanel()?.id, "windows-1");
});

test("Radix tabs resolves to one copy for this package and fumadocs-ui", () => {
const ours = createRequire(import.meta.url);
const fumadocsEntry = ours.resolve("fumadocs-ui/components/tabs");
const theirs = createRequire(fumadocsEntry);
assert.equal(
realpathSync(theirs.resolve("@radix-ui/react-tabs")),
realpathSync(ours.resolve("@radix-ui/react-tabs")),
);
});
Loading
Loading