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/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..384ca23b56 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 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(`
${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; } + const attached = result.join('') + html.slice(pos); + // A plain space between an inline paragraph and its control is a legal line + // break. Bind the last word to the control even near a narrow right edge. + // Adjacent unlabeled source records for one point share one disclosure; + // never collapse anchors, custom summaries or author-specified attributes. + const nodes = parseDocument(attached, { withStartIndices: true, withEndIndices: true }); + const standard = n => 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) === '