From f6c4659f64b085377d2ea4b1d33e21f2dc60b8e4 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph <49103247+hannesrudolph@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:09:06 -0600 Subject: [PATCH 1/3] Keep compact release disclosures with their bullet inside grouped accordions --- scripts/docs-site/mdx-ish.mjs | 3 +- .../docs-site/release-inline-details.test.mjs | 8 +++-- scripts/docs-site/release-point-toggles.mjs | 30 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 scripts/docs-site/release-point-toggles.mjs diff --git a/scripts/docs-site/mdx-ish.mjs b/scripts/docs-site/mdx-ish.mjs index 4d2462a771..586a5d1d9c 100644 --- a/scripts/docs-site/mdx-ish.mjs +++ b/scripts/docs-site/mdx-ish.mjs @@ -20,6 +20,7 @@ import typescript from "highlight.js/lib/languages/typescript"; import xml from "highlight.js/lib/languages/xml"; import yaml from "highlight.js/lib/languages/yaml"; import { icons as lucideIcons } from "lucide"; +import { attachReleasePointToggles } from "./release-point-toggles.mjs"; import { frameArticleMedia } from "./media-scenes.mjs"; const languages = { @@ -209,7 +210,7 @@ function mermaidHtml(source) { export function renderMdxish(markdown, md, options) { const { tokens, env } = parseDocsDocument(markdown, md, options); - return rewriteDocsRelativeLinks(frameArticleMedia(postprocess(md.renderer.render(tokens, md.options, env))), options); + return rewriteDocsRelativeLinks(frameArticleMedia(attachReleasePointToggles(postprocess(md.renderer.render(tokens, md.options, env)))), options); } function postprocess(html) { diff --git a/scripts/docs-site/release-inline-details.test.mjs b/scripts/docs-site/release-inline-details.test.mjs index d7edfa2f54..bf8c801db4 100644 --- a/scripts/docs-site/release-inline-details.test.mjs +++ b/scripts/docs-site/release-inline-details.test.mjs @@ -19,13 +19,15 @@ test("patch details follow the fix inline and retain native keyboard access", as `; const css = fs.readFileSync(new URL("./docs-layout.css", import.meta.url), "utf8"); try { - for (const width of [1200, 390]) { + for (const grouped of [false, true]) for (const width of [1200, 390]) { const page = await browser.newPage({ viewport: { width, height: 700 } }); try { - await page.setContent(`
${renderMdxish(source, createMarkdownRenderer())}
`); + await page.setContent(`
${renderMdxish(grouped ? `\n\n\n${source}\n\n` : source, createMarkdownRenderer())}
`); + if (grouped) await page.locator(".oc-accordion > summary").click(); const summary = page.locator(".release-source-inline > summary"); const link = page.getByRole("link", { name: "#123", exact: true }); assert.equal(await link.isVisible(), false); + await summary.scrollIntoViewIfNeeded(); const layout = await summary.evaluate((element) => { const paragraph = element.parentElement.previousElementSibling; const range = document.createRange(); @@ -42,7 +44,7 @@ test("patch details follow the fix inline and retain native keyboard access", as }); assert.equal(layout.paragraphDisplay, "inline"); assert.ok(layout.control.height <= 24, "keep the visible control compact"); - assert.equal(layout.pointerArea, true, "retain a 44px pointer target around the control"); + assert.equal(layout.pointerArea, true, `retain a 44px pointer target (grouped=${grouped}, width=${width}): ${JSON.stringify(layout)}`); assert.equal(layout.overflow, false, "narrow view must not scroll horizontally"); if (width === 1200) { assert.ok(layout.control.left >= layout.end.right, "control follows the final character"); diff --git a/scripts/docs-site/release-point-toggles.mjs b/scripts/docs-site/release-point-toggles.mjs new file mode 100644 index 0000000000..380fbd220b --- /dev/null +++ b/scripts/docs-site/release-point-toggles.mjs @@ -0,0 +1,30 @@ +import { DomUtils, parseDocument } from "htmlparser2"; + +// Component indentation normalization can split a compact disclosure from its +// Markdown bullet inside a topic accordion. Repair only that exact sibling +// shape, at render time, without changing authored Markdown or link content. +export function attachReleasePointToggles(html) { + if (!html.includes('release-source-inline')) return html; + const tree = parseDocument(html, { withStartIndices: true, withEndIndices: true }); + const edits = []; + const hasClass = (node, name) => node?.attribs?.class?.split(/\s+/).includes(name); + const nonblank = n => n.type !== 'text' || n.data.trim(); + for (const details of DomUtils.findAll(n => n.name === 'details' && hasClass(n, 'release-source-inline'), tree.children)) { + if (!hasClass(details.parent, 'oc-accordion-content')) continue; + let list = details.prev; + while (list && !nonblank(list)) list = list.prev; + if (list?.name !== 'ul') continue; + const item = list.children.findLast(nonblank); + if (item?.name !== 'li') continue; + const content = item.children.filter(nonblank); + if (!content.length || content.some(n => ['ul', 'ol', 'details', 'div', 'pre', 'table'].includes(n.name))) continue; + const start = item.startIndex + html.slice(item.startIndex, content[0].startIndex).indexOf('>') + 1; + const end = item.endIndex + 1 - ''.length; + const body = html.slice(start, end); + const paragraph = content.some(n => n.name === 'p') ? body : `

${body}

`; + edits.push([start, details.endIndex + 1, paragraph + '\n' + html.slice(details.startIndex, details.endIndex + 1) + '\n\n']); + } + const result = []; let pos = 0; + for (const [start,end,markup] of edits) { result.push(html.slice(pos,start),markup); pos=end; } + return result.join('') + html.slice(pos); +} From bd9af7b9d3d8f764f4549c17a7af2d0cb23667f3 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph <49103247+hannesrudolph@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:14:07 -0600 Subject: [PATCH 2/3] Use the inline chevron on standalone release points too --- scripts/docs-site/docs-layout.css | 4 ++-- scripts/docs-site/release-inline-details.test.mjs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/docs-site/docs-layout.css b/scripts/docs-site/docs-layout.css index 82e365aace..f087d3ef10 100644 --- a/scripts/docs-site/docs-layout.css +++ b/scripts/docs-site/docs-layout.css @@ -214,8 +214,8 @@ @media (prefers-reduced-motion:reduce) { .docs-layout .doc .release-source-toggle > summary::before { transition: none; }} .docs-layout .doc .release-source-toggle > summary:focus-visible { outline: 2px solid var(--oc-focus-ring); outline-offset: 2px; } -/* Patch lists keep their detail control in the sentence's inline flow. */ -.docs-layout .doc li:has(> .release-source-inline) > p:first-child { display: inline; margin: 0; } +/* A single point or a list item shares its last line with its source toggle. */ +.docs-layout .doc p:has(+ details.release-source-inline) { display: inline; margin: 0; } .docs-layout .doc .release-source-inline { display: inline; } .docs-layout .doc .release-source-inline > summary { display: inline-flex; vertical-align: middle; min-block-size: 0; inline-size: 20px; block-size: 20px; justify-content: center; margin-inline-start: .2em; padding: 0; border-radius: 4px; color: var(--muted); font-size: 0; line-height: 0; position: relative; } /* Inline patch-release details: a small chevron only; the label stays for assistive tech. */ diff --git a/scripts/docs-site/release-inline-details.test.mjs b/scripts/docs-site/release-inline-details.test.mjs index bf8c801db4..c13f7602a8 100644 --- a/scripts/docs-site/release-inline-details.test.mjs +++ b/scripts/docs-site/release-inline-details.test.mjs @@ -19,11 +19,11 @@ test("patch details follow the fix inline and retain native keyboard access", as `; const css = fs.readFileSync(new URL("./docs-layout.css", import.meta.url), "utf8"); try { - for (const grouped of [false, true]) for (const width of [1200, 390]) { + for (const shape of ["list", "grouped-list", "single"]) for (const width of [1200, 390]) { const page = await browser.newPage({ viewport: { width, height: 700 } }); try { - await page.setContent(`
${renderMdxish(grouped ? `\n\n\n${source}\n\n` : source, createMarkdownRenderer())}
`); - if (grouped) await page.locator(".oc-accordion > summary").click(); + await page.setContent(`
${renderMdxish(shape === "list" ? source : `\n\n\n${shape === "single" ? source.split("- An unrelated")[0].slice(2).replace(/^ /gm, "") : source}\n\n`, createMarkdownRenderer())}
`); + if (shape !== "list") await page.locator(".oc-accordion > summary").click(); const summary = page.locator(".release-source-inline > summary"); const link = page.getByRole("link", { name: "#123", exact: true }); assert.equal(await link.isVisible(), false); @@ -44,7 +44,7 @@ test("patch details follow the fix inline and retain native keyboard access", as }); assert.equal(layout.paragraphDisplay, "inline"); assert.ok(layout.control.height <= 24, "keep the visible control compact"); - assert.equal(layout.pointerArea, true, `retain a 44px pointer target (grouped=${grouped}, width=${width}): ${JSON.stringify(layout)}`); + assert.equal(layout.pointerArea, true, `retain a 44px pointer target (shape=${shape}, width=${width}): ${JSON.stringify(layout)}`); assert.equal(layout.overflow, false, "narrow view must not scroll horizontally"); if (width === 1200) { assert.ok(layout.control.left >= layout.end.right, "control follows the final character"); From 7a1496e5fc6865090259638536eb70f6544bcb27 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph <49103247+hannesrudolph@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:52:33 -0600 Subject: [PATCH 3/3] Prevent the 11.5 source chevrons from wrapping off their points --- .../docs-site/release-inline-details.test.mjs | 11 +++++++- scripts/docs-site/release-point-toggles.mjs | 27 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/scripts/docs-site/release-inline-details.test.mjs b/scripts/docs-site/release-inline-details.test.mjs index c13f7602a8..384ca23b56 100644 --- a/scripts/docs-site/release-inline-details.test.mjs +++ b/scripts/docs-site/release-inline-details.test.mjs @@ -46,7 +46,7 @@ test("patch details follow the fix inline and retain native keyboard access", as assert.ok(layout.control.height <= 24, "keep the visible control compact"); assert.equal(layout.pointerArea, true, `retain a 44px pointer target (shape=${shape}, width=${width}): ${JSON.stringify(layout)}`); assert.equal(layout.overflow, false, "narrow view must not scroll horizontally"); - if (width === 1200) { + { assert.ok(layout.control.left >= layout.end.right, "control follows the final character"); assert.ok(layout.control.top < layout.end.bottom && layout.control.bottom > layout.end.top, "control and sentence share a line"); } @@ -65,3 +65,12 @@ test("patch details follow the fix inline and retain native keyboard access", as } } finally { await browser.close(); } }); + + +test("consecutive source records for one release point keep their links under one toggle", () => { + const record = n => `
\nMore details\n\n[#${n}](https://github.com/example/repo/pull/${n}).\n\n
`; + const html=renderMdxish(`\n\nFinal [link](https://example.org).\n\n${record(12)}\n\n${record(34)}\n\n`,createMarkdownRenderer()); + assert.equal(html.match(/More details/g)?.length,1); + assert.match(html,/⁠<\/p>
n?.name === 'details' && Object.keys(n.attribs).length === 1 && + hasClass(n, 'release-source-toggle') && hasClass(n, 'release-source-inline') && + n.children.find(nonblank)?.name === 'summary' && + attached.slice(n.children.find(nonblank).startIndex, n.children.find(nonblank).endIndex + 1) === 'More details'; + const replacements = []; + for (const d of DomUtils.findAll(standard, nodes.children)) { + let prev = d.prev; + while (prev && !nonblank(prev)) prev = prev.prev; + if (!prev) continue; + if (prev.name === 'p') { + const end = prev.endIndex + 1 - '

'.length; + if (attached.slice(end, prev.endIndex + 1) === '

') replacements.push([end, d.startIndex, '⁠

']); + } else if (standard(prev) && hasClass(d.parent, 'oc-accordion-content')) { + const end = prev.endIndex + 1 - '
'.length; + if (attached.slice(end, prev.endIndex + 1) === '') replacements.push([end, d.children.find(nonblank).endIndex + 1, '\n']); + } + } + const joined = []; let cursor = 0; + for (const [start,end,markup] of replacements) { joined.push(attached.slice(cursor,start), markup); cursor=end; } + return joined.join('') + attached.slice(cursor); }