New Tab suggestions: solid, deduped, ranked, dismissable

Merged
TE
25d ago
+443-72

Summary

The New Tab search suggestions (Leo 10-13: "red" typed on a wallpaper theme):

  • Solid surface. The popover's fill sits on the opaque popup surface (--surface-popup), not the page background, which is see-through on a wallpaper theme. The New Tab rows and Chats list no longer show through the suggestions.
  • One row per page. Rows dedupe by canonical address: no scheme, www., fragment or trailing slash, no tracking parameters (utm_*, fbclid, gclid, si, …), and a bot check's answer (?solution=…&js_challenge=1&token=…) dropped. Parameters that name a page (id, list, v, q, sha, page tokens, ref) stay, so two Drive files never merge. A page an open browser tab shows is that tab, "Switch to tab".
  • Clean rows. Titles lose the site's tagline on its front page ("Reddit - The heart of the internet" becomes "Reddit") and a trailing site name ("… : r/rust - Reddit"). The detail is the short host; a file page shows its path.
  • Chrome/Arc order, capped. The top hit (the address, else its best completion), open tabs, workspaces, visited pages, the web search, then Ask; at most 8 rows. Prompt text is unchanged: Ask, a web search, then up to 4 matches.
  • Dismiss. A press outside the composer and Escape close the suggestions and keep the typed text. A second Escape leaves the field. Pressing the field, typing, or Down/Up opens them again. Return on closed suggestions still takes their top row.

Testing

Red then green:

  • test/new-tab-suggestions.test.ts (new): the photo's data gives one Reddit row (the tab, "Reddit", reddit.com); the order; a typed address switches to its tab; the cap; canonical addresses; titles; page ids kept; a typed link to another Drive file stays an open row; file pages.
  • test/new-tab-omnibar.test.tsx: outside press, Escape then Escape, Return after Escape.
  • test/popup-surface.test.ts (browser lane): .nt-popover is the opaque popup surface over a see-through page. Run locally with CMUX_BROWSER_TESTS=1: on the red CSS, the agent-pane case fails in Chromium and WebKit (new-tab-suggestions has the page's transparent fill); on the fix, all 6 pass. CI's webviews-checks stops at the base's vp check errors before it reaches bun test.
  • Gallery: agent-pane.new-tab variants typed-red-duplicates (the photo's data) and typed-dismissed.

Locally (merged head): bun run check is green except 4 type errors in NewTabPage.gallery.tsx (defaultKind), which are on base since #19041/#20127 and untouched here. bun test test/new-tab-*.test.* test/ui-rules.test.ts: all pass.

Reviewed by a review subagent; its findings (page ids merged by a long-token rule, GitHub repo titles collapsing to "GitHub", Return doing nothing after Escape, file pages showing "file:") are fixed with tests.

Coordinated with op-next-appstore (composer rebuild) and op-next-icons (visual styling): no overlapping hunks.

Changelog

Fixed: New Tab search suggestions are a solid surface, list each page once (the open tab first), rank like a browser's address bar, and close on a click outside or Escape without losing the text.

🤖 Generated with Claude Code