fix: hide hero during search, make header search work on every route (#615)#616
Conversation
…LM-Coding#615) Two search UX problems: 1. Typing on the home page filtered the grid, but the hero section pushed the results below the fold. An active search query now hides the hero (restored on clearing); the role filter alone deliberately leaves it in place. Toggled centrally in applyCardFilters(), the shared funnel of both search inputs. 2. The header search box was dead on every other route (nothing to filter, no results page) and the counter sat at a meaningless "0/0". Typing away from home now navigates to the home page, where grid initialization picks the query up from the header input (which survives the route switch because the header is not re-rendered). The router announces resolved routes via a route:changed CustomEvent; main.js uses it to hide the anchor counter outside the home route. TDD: 4 new unit tests (hero hide/restore/role-only, route event) plus 3 new E2E scenarios — full suites green (115 unit, 38 E2E). Verified in the built preview via Playwright: hero block->none->block on query/clear with live counter, search from /about/ lands filtered on home, counter hidden on doc routes, static no-JS home unchanged. App version 0.7.0 -> 0.8.0. Closes LLM-Coding#615 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review WalkthroughDie Pull Request implementiert eine Such-UX-Verbesserung ( ChangesSearch UX Feature mit Cross-Route-Navigation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Implements the agreed UX direction from #615.
1. Search results were invisible (home)
An active search query now hides the hero section, so results appear directly under the header; clearing the query restores it. Toggled in
applyCardFilters()— the single funnel both search inputs (desktop header + mobile) already flow through. The role filter alone deliberately leaves the hero in place.2. Search was dead on non-home routes
Typing in the header search anywhere else now navigates to the home page and applies the query there — the home page acts as the search-results page. No polling needed: the header (and the typed text in it) survives the route switch because only
#page-contentis re-rendered; grid initialization picks the pending query up from the input.3. "0/0 anchors" counter on doc pages
The router now announces resolved routes via a
route:changedCustomEvent (kept free of UI knowledge);main.jshides the#anchor-countelement on every route except home.Verification
route:changed) — 115/115 pass/about/; typing on/about/lands on/with filtered grid and visible counter) — 38/38 pass locallyblock → none → blockon query/clear, 3 visible cards + counter "3" for "tdd"; static no-JS home unchanged (hero markup present via curl)Closes #615
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Neue Funktionen
Tests
Dokumentation