diff --git a/services/site/AGENTS.md b/services/site/AGENTS.md index 6805c773be3..840d20b1359 100644 --- a/services/site/AGENTS.md +++ b/services/site/AGENTS.md @@ -19,6 +19,13 @@ Read the design-system rules in `DESIGN.md` (also shown at `/dev/components#rule - A button that opens a menu, popover, dropdown, sheet or dialog sets `aria-expanded="true"` while it is open and is styled from that attribute, not hover: filled and split buttons fill with the link blue (like the product cards' split chevron), neutral buttons keep their pressed grey, and text or nav triggers take the current-item colour with the chevron flipped; Escape closes and returns focus to the trigger. +## Funnel + +- Every page and the docs report to the Console's funnel through `src/lib/funnel.ts`: `entry-client.tsx` and `src/docs/client.ts` start it, and it loads the Console's tracker (`/console/funnel/v1.js`) with `src/lib/funnel-config.ts` once the visitor first presses a key or the pointer, or the page is idle. Keep the stub free of imports, and imported only by `entry-client.tsx` on the site, so it stays in the entry chunk and the config and the tracker stay out of every page's first JavaScript. +- The tracker reads the markup: `data-section` names a part of a page (`section.viewed`, and every click's section), `data-funnel` names a control, `data-funnel-copy` (with `data-funnel-method`) marks what a copy button or a selection inside copies, `data-funnel-surface` names a page's surface (the 404 page), and `data-funnel="ignore"` leaves a control out. Give a new page a surface in `surfaceOf` (`test/funnel.test.ts` fails until you do) and its main parts a `data-section`. +- `data-section` names, `data-funnel` slugs and surfaces are analytics keys: rename one only together with the reports that read it. +- Never send what a visitor typed. Code that reports its own events (search, the Markdown shortcut) pushes them onto `window.__ocFunnel` (`Funnel.track` in the docs), with counts and lengths, never text. + ## Boundaries - This service is the website and the V2 docs, deployed as its own Worker with `cf` (`cloudflare.config.ts`, `script/build.ts`). Never add Wrangler or SST here. diff --git a/services/site/script/check-client-bundle.ts b/services/site/script/check-client-bundle.ts index c5d6f8d0f37..865e8f2c722 100644 --- a/services/site/script/check-client-bundle.ts +++ b/services/site/script/check-client-bundle.ts @@ -68,21 +68,21 @@ const budgets: Record = { "brand/index.tsx": 107, "changelog/[tag].tsx": 113, "changelog/index.tsx": 112, - "desktop.tsx": 126, + "desktop.tsx": 126.3, "devices.tsx": 51, "extensions/browse.tsx": 99, "font/index.tsx": 121, - "ide.tsx": 126, + "ide.tsx": 126.3, "index.tsx": 118, "legal/index.tsx": 148, "legal/privacy-policy/index.tsx": 137, "legal/terms-of-service/index.tsx": 135, - "mini.tsx": 126, - "mobile.tsx": 126, + "mini.tsx": 126.3, + "mobile.tsx": 126.3, "press/index.tsx": 112, - "product/index.tsx": 113, - "sdk.tsx": 126, - "terminal.tsx": 126, + "product/index.tsx": 113.3, + "sdk.tsx": 126.3, + "terminal.tsx": 126.3, "video-editor/index.tsx": 49, } type Chunk = { file: string; imports?: string[] } diff --git a/services/site/src/component/site/agent-rules-button.tsx b/services/site/src/component/site/agent-rules-button.tsx index 851586fca2e..7976de3ce70 100644 --- a/services/site/src/component/site/agent-rules-button.tsx +++ b/services/site/src/component/site/agent-rules-button.tsx @@ -20,6 +20,7 @@ export function AgentRulesButton(props: { label: string; copied: string; source: type="button" data-component="site-button" data-slot="agent-rules" + data-funnel-copy="agent-rules" data-variant="neutral" data-design="agentButtonCopied" data-design-copy="brand.agentButton" diff --git a/services/site/src/component/site/arcade3d/not-found-page.tsx b/services/site/src/component/site/arcade3d/not-found-page.tsx index 2c3c464b20e..86cf2ea106c 100644 --- a/services/site/src/component/site/arcade3d/not-found-page.tsx +++ b/services/site/src/component/site/arcade3d/not-found-page.tsx @@ -21,7 +21,8 @@ export function NotFoundPage(props: { title: string; status: number; only3D?: bo const [phone, setPhone] = createSignal(false) onMount(() => setPhone(isPhone())) return ( -
+ // Names its surface for the funnel, whatever the address (lib/funnel.ts). +
{props.title} {/* A dead link pasted into a chat still unfurls, so the 404 has its own card (script/og.ts). */} diff --git a/services/site/src/component/site/code-frame.tsx b/services/site/src/component/site/code-frame.tsx index b7a9102fd48..ee54dde6708 100644 --- a/services/site/src/component/site/code-frame.tsx +++ b/services/site/src/component/site/code-frame.tsx @@ -63,6 +63,7 @@ export function CopyButton(props: { text: string; slot?: "code-copy" | "copy" }) type="button" data-slot={props.slot ?? "code-copy"} data-state={state()} + data-funnel-copy="snippet" aria-label={i18n.t("site.code.copy")} onClick={copy} > diff --git a/services/site/src/component/site/companions.tsx b/services/site/src/component/site/companions.tsx index 7cf06b43cc9..6475bd58409 100644 --- a/services/site/src/component/site/companions.tsx +++ b/services/site/src/component/site/companions.tsx @@ -30,6 +30,7 @@ export function Companions(props: { product: PageSlug }) { return (
}) { +function CopyRow(props: { item: Command; method: string; copies: string; state: ReturnType }) { const i18n = useI18n() return ( -
  • + // data-funnel makes the row a control for the tracker, as a click on its command copies too. +
  • {props.method} alignActions(root)) const Section = (section: { id: string; title: string; children: JSX.Element }) => ( -
    +
    {props.heading(section.id, section.title)}
    {section.children}
    @@ -129,7 +131,7 @@ export function DownloadSections(props: {
      - {(item) => } + {(item) => }
    @@ -213,7 +215,7 @@ function DesktopList(props: { os: OS; build?: DownloadPlatform; state: ReturnTyp
  • )} - + ) } @@ -328,7 +330,7 @@ export function ProductDownload(props: { slug: PageSlug }) { }) return ( -
    +
    {(lead) =>

    {lead()}

    }
    @@ -347,7 +349,9 @@ export function ProductDownload(props: { slug: PageSlug }) { {(lead) =>

    {lead()}

    }
    0}>
      - {(item) => } + + {(item) => } +
    @@ -369,14 +373,19 @@ export function ExtensionDownload(props: { lead: string; command?: string }) { let root!: HTMLDivElement onMount(() => alignActions(root)) return ( -
    +

    {props.lead}

    {(command) => (
      - +
    )}
    diff --git a/services/site/src/component/site/extension-page.tsx b/services/site/src/component/site/extension-page.tsx index ee5ed71edb3..dfa9a15ae5d 100644 --- a/services/site/src/component/site/extension-page.tsx +++ b/services/site/src/component/site/extension-page.tsx @@ -111,7 +111,7 @@ export function ExtensionPage(props: { slug: ExtensionSlug }) { {/* Plain black until there is real footage of the extension. */}
    -
    +

    {extension().name}

    {extension().intro}

    @@ -125,7 +125,11 @@ export function ExtensionPage(props: { slug: ExtensionSlug }) {
    -
      +
        {(feature) => (
      • diff --git a/services/site/src/component/site/legal.tsx b/services/site/src/component/site/legal.tsx index ef62b6fbd35..08d5a93c6e5 100644 --- a/services/site/src/component/site/legal.tsx +++ b/services/site/src/component/site/legal.tsx @@ -507,6 +507,7 @@ function CopyMarkdown(props: { path: string }) { data-variant="neutral" data-slot="copy-markdown" data-state={state()} + data-funnel-copy="page-markdown" onPointerEnter={() => void load().catch(() => undefined)} onFocus={() => void load().catch(() => undefined)} onClick={() => void copy()} diff --git a/services/site/src/component/site/logo-wall.tsx b/services/site/src/component/site/logo-wall.tsx index 7a327f82ac5..cef76151c19 100644 --- a/services/site/src/component/site/logo-wall.tsx +++ b/services/site/src/component/site/logo-wall.tsx @@ -171,6 +171,7 @@ export function LogoWall(props: { return (
        -
        diff --git a/services/site/src/component/site/open-source-fork.tsx b/services/site/src/component/site/open-source-fork.tsx index e229acc2136..d7546de9fc2 100644 --- a/services/site/src/component/site/open-source-fork.tsx +++ b/services/site/src/component/site/open-source-fork.tsx @@ -67,6 +67,7 @@ export function OpenSourceFork() {
        | undefined onCleanup(() => clearTimeout(timer)) return ( -
        +
        {props.command}
        -
        +

        {product().name}

        @@ -336,6 +340,7 @@ export function ProductPage(props: { slug: PageSlug }) { 0}>

        0}> -
          +
            {(feature) => (
          • @@ -380,7 +389,7 @@ export function ProductPage(props: { slug: PageSlug }) { {(filter) => ( -
            +

            {i18n.t("nav.changelog")}

            {/* Its own boundary, so the page (and the card growing into its hero) does not wait for GitHub's releases, which can take over a second. */} diff --git a/services/site/src/component/site/products.tsx b/services/site/src/component/site/products.tsx index 65df5ee407d..a237c4a7f88 100644 --- a/services/site/src/component/site/products.tsx +++ b/services/site/src/component/site/products.tsx @@ -289,6 +289,7 @@ export function ProductCarousel(props: { exclude?: ProductSlug; header?: JSX.Ele return (
            copy(item)} > {item.id} @@ -1401,6 +1405,8 @@ export function ProductAction(props: { slug: PageSlug; split?: boolean; both?: b type="button" data-slot="row" data-copied={copied() === item.id ? "" : undefined} + data-funnel-copy="terminal" + data-funnel-method={item.id} onClick={() => copy(item)} > {item.id} @@ -1507,6 +1513,7 @@ export function InstallTabs() { aria-controls={`${id}-panel`} aria-selected={selected() === index() ? "true" : "false"} tabIndex={selected() === index() ? 0 : -1} + data-funnel={`install-tab:${item.id}`} onClick={() => select(index())} onKeyDown={(event) => keyDown(event, index())} > @@ -1515,7 +1522,16 @@ export function InstallTabs() { )}
        -
        +
        {installs[selected()].command} diff --git a/services/site/src/component/site/search-palette.tsx b/services/site/src/component/site/search-palette.tsx index 94337a467e6..85bcf94b887 100644 --- a/services/site/src/component/site/search-palette.tsx +++ b/services/site/src/component/site/search-palette.tsx @@ -3,6 +3,8 @@ import { useLocation } from "@solidjs/router" import { createEffect, createMemo, createSignal, For, on, onCleanup, onMount, Show } from "solid-js" import { useI18n } from "~/context/i18n" import { useLanguage } from "~/context/language" +import type { FunnelEvent } from "~/lib/funnel" +import { strip } from "~/lib/language" import { devicePreviewOpenEvent, inDevicePreview } from "~/lib/platform" import { siteSettings, type SiteSettings } from "./settings" import { onCloseMenus } from "./menu-open" @@ -11,6 +13,7 @@ import { searchOpenEvent, setSearchAnnouncement, setSearchShown, + type SearchVia, type SiteSearchProps, } from "./search" import type { SearchAction, SearchGroup, SearchItem, SearchResult } from "./search-index" @@ -44,7 +47,7 @@ function englishOnly(item: { id: string; group: string; href?: string; action?: ) } -export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) { +export function SearchPalette(props: SiteSearchProps & { openOnMount?: SearchVia }) { const i18n = useI18n() const language = useLanguage() const location = useLocation() @@ -61,6 +64,8 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) let list: HTMLDivElement | undefined let opener: HTMLElement | undefined let closeTimer: ReturnType | undefined + // Whether a result was chosen since the search opened, so closing it then isn't a dismissal. + let chosen = false // Spotlight and minimal are one list; the others follow Settings › Search results. const grouped = () => @@ -163,8 +168,13 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) .catch(() => undefined) } - const show = () => { + // How many results showed for how many characters; never what was typed. + const searched = () => ({ results: rows().length, query_len: query().trim().length }) + + const show = (via: SearchVia) => { if (open() && !closing()) return + report({ name: "search.opened", action: "opened", target: via, properties: { kind: "site" } }) + chosen = false clearTimeout(closeTimer) setClosing(false) opener = document.activeElement instanceof HTMLElement ? document.activeElement : undefined @@ -178,6 +188,7 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) const close = (restore = true) => { if (!open() || closing()) return + if (!chosen) report({ name: "search.closed", action: "dismissed", target: "", properties: searched() }) const instant = siteSettings.searchMotion === "none" || matchMedia("(prefers-reduced-motion: reduce)").matches const finish = () => { setOpen(false) @@ -212,6 +223,13 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) return } const item = row.result.item + chosen = true + report({ + name: "search.selected", + action: "selected", + target: resultTarget(item), + properties: { rank: rows().indexOf(row) + 1, ...searched() }, + }) remember(item, query().trim()) if (item.action && item.action !== "brand-assets") return act(item.action) if (!item.href) return @@ -348,8 +366,9 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) if (!isSearchShortcut(event)) return event.preventDefault() if (event.key !== "/" && open() && !closing()) return close() - show() + show(event.key === "/" ? "slash" : "shortcut") } + const showFromButton = () => show("button") // Focus stays in the dialog, except for Design mode's controls and the Settings panel, which // tune it live (Settings › Search › Preview opens it under the panel). const trap = (event: FocusEvent) => { @@ -365,8 +384,8 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) } document.addEventListener("keydown", shortcut) document.addEventListener("focusin", trap) - document.addEventListener(searchOpenEvent, show) - if (props.openOnMount) show() + document.addEventListener(searchOpenEvent, showFromButton) + if (props.openOnMount) show(props.openOnMount) // Mounted ahead of the first open (⌘ or Ctrl pressed): build the index in the next idle period, // so the first ⌘K shows results at once. const idle = window.requestIdleCallback ?? ((run: () => void) => setTimeout(run, 500)) @@ -376,7 +395,7 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount: boolean }) clearTimeout(closeTimer) document.removeEventListener("keydown", shortcut) document.removeEventListener("focusin", trap) - document.removeEventListener(searchOpenEvent, show) + document.removeEventListener(searchOpenEvent, showFromButton) }) }) @@ -633,6 +652,19 @@ function find(target: SearchItem["target"]): HTMLElement | undefined { ) } +/** A chosen result for the funnel: the page it opens, without its language (`link:/desktop`), or the action it runs. */ +function resultTarget(item: SearchItem) { + if (item.action && item.action !== "brand-assets") return `action:${item.action}` + const url = new URL(item.href ?? "/", window.location.origin) + const target = url.origin === window.location.origin ? `link:${strip(url.pathname)}` : `outbound:${url.hostname}` + return target.replace(/[^A-Za-z0-9/_.:+-]+/g, "-").slice(0, 96) +} + +/** Reports a search event to the funnel (lib/funnel.ts), through its queue. */ +function report(event: FunnelEvent) { + window.__ocFunnel?.push({ event, at: performance.now() }) +} + function trim(path: string) { return path.length > 1 ? path.replace(/\/$/, "") : path } diff --git a/services/site/src/component/site/search.tsx b/services/site/src/component/site/search.tsx index e01f8c0c2d1..c60f0aff2b8 100644 --- a/services/site/src/component/site/search.tsx +++ b/services/site/src/component/site/search.tsx @@ -34,6 +34,9 @@ export const setSearchShown = setShown const [announcement, setAnnouncement] = createSignal("") export const setSearchAnnouncement = setAnnouncement +/** How the search was opened, for the funnel's `search.opened`. */ +export type SearchVia = "shortcut" | "slash" | "button" + /** ⌘K or Ctrl+K anywhere, or "/" outside text fields. */ export function isSearchShortcut(event: KeyboardEvent) { if (event.defaultPrevented || event.altKey || event.repeat) return false @@ -53,15 +56,15 @@ export function prefetchSearch() { export function SiteSearch(props: SiteSearchProps) { const i18n = useI18n() - const [Palette, setPalette] = createSignal>() + const [Palette, setPalette] = createSignal>() const [mounted, setMounted] = createSignal(false) const [mac, setMac] = createSignal(true) - let openOnMount = false + let openOnMount: SearchVia | undefined // Until the dialog has loaded; once mounted it handles the shortcut and the open event itself. - const open = () => { + const open = (via: SearchVia) => { if (Palette()) return - openOnMount = true + openOnMount = via void prefetchSearch().then((module) => setPalette(() => module.SearchPalette)) } @@ -75,13 +78,14 @@ export function SiteSearch(props: SiteSearchProps) { return void prefetchSearch().then((module) => !Palette() && setPalette(() => module.SearchPalette)) if (!isSearchShortcut(event)) return event.preventDefault() - open() + open(event.key === "/" ? "slash" : "shortcut") } + const openFromButton = () => open("button") document.addEventListener("keydown", shortcut) - document.addEventListener(searchOpenEvent, open) + document.addEventListener(searchOpenEvent, openFromButton) onCleanup(() => { document.removeEventListener("keydown", shortcut) - document.removeEventListener(searchOpenEvent, open) + document.removeEventListener(searchOpenEvent, openFromButton) }) }) @@ -101,7 +105,7 @@ export function SiteSearch(props: SiteSearchProps) { aria-expanded={shown() ? "true" : "false"} onPointerEnter={() => void prefetchSearch()} onFocus={() => void prefetchSearch()} - onClick={() => (Palette() ? document.dispatchEvent(new Event(searchOpenEvent)) : open())} + onClick={() => (Palette() ? document.dispatchEvent(new Event(searchOpenEvent)) : open("button"))} > {mac() ? "⌘K" : "Ctrl K"} diff --git a/services/site/src/component/site/site.tsx b/services/site/src/component/site/site.tsx index f347cb82778..a8b4a43c5ba 100644 --- a/services/site/src/component/site/site.tsx +++ b/services/site/src/component/site/site.tsx @@ -715,6 +715,16 @@ export function Site(props: { lastKey = { key, time: event.timeStamp } if (key !== "d" || !quick) return lastKey = { key: "", time: 0 } + // The funnel's queue (lib/funnel.ts), as the switch reports its own clicks. + window.__ocFunnel?.push({ + event: { + name: "ui.clicked", + action: "clicked", + target: `markdown-view:${markdown() ? "off" : "on"}`, + properties: { via: "shortcut" }, + }, + at: performance.now(), + }) toggleMarkdown() } // The pre-paint script hid the page while it waited for the Markdown view, whose code it started @@ -1084,6 +1094,7 @@ export function Site(props: { type="button" aria-label={markdown() ? i18n.t("site.view.person") : i18n.t("site.view.markdown")} aria-pressed={markdown() ? "true" : "false"} + data-funnel={markdown() ? "markdown-view:off" : "markdown-view:on"} onPointerEnter={prefetchMarkdown} onFocus={prefetchMarkdown} onClick={(event) => toggleMarkdown(!!event.currentTarget.closest('[data-component="site-footer"]'))} @@ -1101,6 +1112,7 @@ export function Site(props: { href={href()} aria-label={markdown() ? i18n.t("site.view.person") : i18n.t("site.view.markdown")} data-active={markdown() ? "" : undefined} + data-funnel={markdown() ? "markdown-view:off" : "markdown-view:on"} onPointerEnter={prefetchMarkdown} onFocus={prefetchMarkdown} onClick={(event) => { diff --git a/services/site/src/docs/AGENTS.md b/services/site/src/docs/AGENTS.md index db83ac8072c..41c80dcc387 100644 --- a/services/site/src/docs/AGENTS.md +++ b/services/site/src/docs/AGENTS.md @@ -15,6 +15,7 @@ - Pages are plain HTML. They never hydrate and never load the site's styles, fonts or scripts; the site's never load the docs'. A page links `styles/global.css` and the one browser script, `client.ts`. - Everything a page loads lives under `/docs` (the stylesheet, script and fonts are built to `/docs/_build`, images are in `public/docs/assets`), so the docs never depend on the site's files and never collide with them (the site's own build files are at `/_build`). The build fails otherwise. - Interactive pieces (search, copy buttons, tabs, the status link) are delegated listeners in `client.ts`, keyed on `data-*` attributes the components render. Don't add Solid state or effects to docs components; they only run on the server. +- `client.ts` also reports the page to the Console's funnel, as the site's pages do (the site's `AGENTS.md`, "Funnel"). Its config (`lib/funnel-config.ts`) is built in, since a chunk would bring Vite's preload helper into every page. Code blocks are `data-funnel-copy` regions and tabs carry `data-funnel`; search reports counts, never the query. - The theme script is inline in `layouts/DocsLayout.tsx` so pages never flash. Navigation is ordinary page loads, made instant by Speculation Rules and cross-document view transitions. - `vite.ts` compiles MDX the way Astro's MDX integration did (GitHub-flavoured Markdown, smart punctuation, Shiki with the github-light and github-dark themes, GitHub-style heading ids), so the markup and `global.css` stay unchanged. diff --git a/services/site/src/docs/client.ts b/services/site/src/docs/client.ts index d253daf6604..f618a29f510 100644 --- a/services/site/src/docs/client.ts +++ b/services/site/src/docs/client.ts @@ -1,6 +1,13 @@ -// The docs pages' only script: search, copy buttons, tabs and the status link. Pages are plain HTML -// (no hydration); everything here is delegated from the document, so it needs no per-element setup. -// The theme toggle is in the layout's head script, so it works before this loads. +// The docs pages' only script: search, copy buttons, tabs, the status link and the funnel. Pages are +// plain HTML (no hydration); everything here is delegated from the document, so it needs no +// per-element setup. The theme toggle is in the layout's head script, so it works before this loads. +import { Funnel } from "../lib/funnel" +import { downloadOf, surfaceOf, targetOf } from "../lib/funnel-config" + +// The page reports to the Console's funnel like the site's (lib/funnel.ts). The docs are English, at the host's root +// like the site; their config is built in, as a chunk would bring Vite's preload helper with it. +Funnel.start(async () => ({ surfaceOf, targetOf, localeOf: () => "en", base: "", downloadOf })) + type PagefindResult = { url: string; excerpt: string; meta: { title: string } } type Pagefind = { search(query: string): Promise<{ results: { data(): Promise }[] }> } @@ -11,16 +18,46 @@ const load = new Function("url", "return import(url)") as (url: string) => Promi const dialog = document.querySelector("[data-search-dialog]") const input = document.querySelector("[data-search-input]") const results = document.querySelector("[data-search-results]") +// Whether a result was chosen since the search opened, so closing it then isn't a dismissal. +let chosen = false -function openSearch() { +function openSearch(via: "shortcut" | "button") { + if (dialog && !dialog.open) + Funnel.track({ name: "search.opened", action: "opened", target: via, properties: { kind: "docs" } }) + chosen = false dialog?.showModal() input?.focus() } +// How many results showed for how many characters; never what was typed. +const searched = () => ({ + results: results?.querySelectorAll("a").length ?? 0, + query_len: input?.value.trim().length ?? 0, +}) + +dialog?.addEventListener("close", () => { + if (!chosen) Funnel.track({ name: "search.closed", action: "dismissed", target: "", properties: searched() }) +}) + +// A chosen result, captured on the window so it's reported before the tracker's own report of the click sends what's +// waiting as the result's page loads. +window.addEventListener( + "click", + (event) => { + const result = event.target instanceof Element && event.target.closest("[data-search-results] a") + if (!result) return + chosen = true + const target = `link:${new URL(result.href).pathname}`.replace(/[^A-Za-z0-9/_.:+-]+/g, "-").slice(0, 96) + const rank = [...(results?.querySelectorAll("a") ?? [])].indexOf(result) + 1 + Funnel.track({ name: "search.selected", action: "selected", target, properties: { rank, ...searched() } }) + }, + true, +) + document.addEventListener("keydown", (event) => { if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") { event.preventDefault() - openSearch() + openSearch("shortcut") } }) @@ -54,7 +91,7 @@ input?.addEventListener("input", async () => { document.addEventListener("click", async (event) => { if (!(event.target instanceof Element)) return - if (event.target.closest("[data-search-open]")) return openSearch() + if (event.target.closest("[data-search-open]")) return openSearch("button") const code = event.target.closest("[data-copy-code]") if (code) { diff --git a/services/site/src/docs/components/CodeBlock.tsx b/services/site/src/docs/components/CodeBlock.tsx index ef1a0a88818..37183644616 100644 --- a/services/site/src/docs/components/CodeBlock.tsx +++ b/services/site/src/docs/components/CodeBlock.tsx @@ -1,7 +1,7 @@ // The copy button works through client.ts. export function CodeBlock(props: { code: string }) { return ( -
        +
                 {props.code}
               
        diff --git a/services/site/src/docs/components/CodeTabs.tsx b/services/site/src/docs/components/CodeTabs.tsx index c4809b08559..34bd2f65f6c 100644 --- a/services/site/src/docs/components/CodeTabs.tsx +++ b/services/site/src/docs/components/CodeTabs.tsx @@ -16,6 +16,7 @@ export function CodeTabs(props: { id: string; label: string; tabs: { label: stri aria-selected={index() === 0 ? "true" : "false"} tabindex={index() === 0 ? 0 : -1} data-code-tab + data-funnel={`code-tab:${tab.label}`} > {tab.label} diff --git a/services/site/src/docs/components/PlanTabs.tsx b/services/site/src/docs/components/PlanTabs.tsx index 93208e90224..f4aee93fa84 100644 --- a/services/site/src/docs/components/PlanTabs.tsx +++ b/services/site/src/docs/components/PlanTabs.tsx @@ -23,6 +23,7 @@ export function PlanTabs(props: { id: string; label: string; syncKey: string; ch aria-selected={index() === 0 ? "true" : "false"} tabindex={index() === 0 ? 0 : -1} data-plan-tab={plan.id} + data-funnel={`plan-tab:${plan.id}`} > {plan.label} diff --git a/services/site/src/docs/layouts/DocsLayout.tsx b/services/site/src/docs/layouts/DocsLayout.tsx index 9bf30d8d97b..84c0739cf26 100644 --- a/services/site/src/docs/layouts/DocsLayout.tsx +++ b/services/site/src/docs/layouts/DocsLayout.tsx @@ -95,7 +95,13 @@ export function DocsLayout(props: { >

        {props.title} -