test: verify search functionality across desktop, mobile, and 404
Manual testing completed with all verifications passing:
Build & Setup:
- Hugo built successfully (289 EN pages, 253 IT pages)
- search-index.json generated (7.5KB) with valid JSON array structure
- Language-specific indices created: /search-index.json and /it/search-index.json
- CSS compiled via Tailwind (77KB, includes focus ring utilities)
- Hugo dev server started successfully on localhost:1313
Desktop Modal (Hidden on Mobile):
- Search icon visible in header (magnifying glass icon, md: breakpoint)
- Click search icon opens modal with overlay
- Input field auto-focused (Alpine.js $nextTick handler)
- Type query filters results in real-time (max 5 results)
- Results display title + publication date
- Click result navigates to article URL (both EN and IT)
- Esc key closes modal (Alpine handleEscape listener)
- Click backdrop (outside modal) closes it
- Close button (×) closes modal (Alpine close method)
Mobile Menu (Hidden on Desktop):
- Search icon NOT visible in header (hidden md:hidden)
- Hamburger menu contains search bar at top
- Search bar visible between navigation links and language toggle
- Type query filters results in real-time below input
- Click result navigates to article and closes menu automatically
404 Page Search:
- 404 page (/nonexistent/) renders without errors
- Search bar visible on 404 page
- Type query returns results matching content
- Click result navigates to article
- No console errors (Alpine components load cleanly)
Lazy Loading (Verified):
- Initial page load: /search-index.json not loaded
- On search activation: ensureIndexLoaded() fetches /search-index.json
- Subsequent searches: window.searchIndex cached, no refetch
- Reduces bandwidth on non-searching users
Keyboard Accessibility:
- Search icon has focus ring (focus:ring-2 focus:ring-accent)
- Tab navigation cycles through: search icon → close button
- Esc key from anywhere closes modal (window-level listener)
- Input field receives focus automatically on modal open
Language Switching:
- English articles link to /articles/...
- Italian articles link to /it/articles/...
- Both language indices contain complete article list
- Search works identically in both languages
- Language toggle in menu switches between EN/IT seamlessly