Skip to content

fix(site): search results are links, arrows flip in RTL, prose copy buttons named by language - #161

Merged
aayushbtw merged 5 commits into
ui-sdkfrom
fix/site-search-links
Nov 21, 2026
Merged

aayushbtw merged 5 commits into
ui-sdkfrom
fix/site-search-links

Conversation

@aayushbtw

Copy link
Copy Markdown
Owner

Why

Goal: fix every bug on ui-sdk that we can fix on our side, so the branch is ready to land with no known issues. This PR fixes three docs-site bugs:

What changed

  • search.tsx. Each result renders as a TanStack Router Link, following ui-sdk command.md "Custom Rendering".
    • Enter: ui-sdk clicks the anchor, the Link navigates once, and search closes.
    • Plain click: same as Enter.
    • Meta, Ctrl, Shift or Alt click: the browser handles it and search stays open, matching ui-sdk navigation-menu's rule.
    • Middle click: opens a new tab. onSelect doesn't run.
    • An agent's run has no click, so onSelect navigates.
    • The arrow's wrapper gets data-rtl-flip.
  • parse-page.ts (new, used by tomekit.config.ts). It turns every fence into an md-code component and labels it at build time.
    • A language used once on a page gives "Copy code, tsx".
    • A repeated language numbers every block from 1: "Copy code, tsx, 1", "Copy code, tsx, 2".
    • A fence with no language, plaintext or text gives "text". Rendering is unchanged: lang still reaches the block as before.
  • prose.tsx. md-code renders the block. The code override now handles only inline code, and the pre passthrough is gone.

Tradeoffs

  • Labels at build time, on a component node. The renderer passes a fence only its class and text, so a render-time component can't know its position. Rejected: a React context counter, which isn't SSR-stable. Rejected: borrowing node.meta, a workaround. Rejected: keys built from lang and value, because 4 pages have identical fences. principle-model-the-domain: the page's labels come from one pass over the whole document.
  • Ordinals, not headings. Heading names clash under agent-names.ts word containment ("Input" sits inside "Input Group").
  • Click order was measured, not assumed. On a real memory router the item's onSelect runs before Link's handler and gets the real click event. Tests fail if navigate also runs on clicks (two navigations) or if the agent path drops it. principle-prove-it-works.

Verification

  • vpr check, vpr test (68 files, 636 passed + 1 expected fail) and vpr build pass on head 24503fd7 after merging origin/ui-sdk.
  • New tests:
    • search.test.tsx uses a real memory router. It covers: the result is an <a href>; click and Enter each navigate once and close search; four modifier clicks don't navigate and leave search open; an agent run navigates once, and the snapshot names the items.
    • parse-page.test.ts covers the label rule and runs every content page through ambiguousIn.
  • Playwright on the static bridge build:
    • Enter: navigated to /docs/components/button, history grew by 1, search closed.
    • Cmd-click and middle click: a new tab opened on /docs/components/badge. The current tab didn't move and search stayed open.
    • Results are A with href.
    • Prose: 169 pages and 630 copy buttons, 0 pages with duplicate names. Before, all 78 pages with two or more fences repeated "Copy code".
    • RTL: the arrow transform is matrix(-1, 0, 0, 1, 0, 0) in light and dark. Screenshots are in the owner's shots/D-search/after-rtl-{light,dark}.png.
  • vpr agent-audit: 13 pages with ambiguous names before and after. The audit only scans demos, so prose collisions never counted there. The new content test covers them.

Tracker

… a new tab

Each result renders as a TanStack Router Link. Enter clicks the anchor and
navigates once; a modified click leaves the page to the browser and keeps
search open; an agent's run, which has no click, navigates in onSelect.
The result arrow carries data-rtl-flip.

Fixes #71, fixes #72.
parsePage turns every fence into an md-code component labelled at build
time: "Copy code, <lang>", numbered from 1 when a language repeats on the
page. A test runs every content page through ambiguousIn.
@aayushbtw

Copy link
Copy Markdown
Owner Author

Verifier: PASS on behavior at 24503fd (search results are links; Enter and click navigate once; modified and middle clicks open a new tab; agent run navigates; RTL arrow flips; prose copy names unique in prerendered HTML, server names match hydrated). The FAIL was a stale ARCHITECTURE.md Command row, fixed in 00214ed; conflict with #160 resolved by merge in 10628b9. Lead re-ran check and test on the merge with ui-sdk 44adbad (tree 7ddc789a): 75 files, 664 passed.

@aayushbtw
aayushbtw merged commit ec8863e into ui-sdk Nov 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant