Skip to content

fix(web): fix landing page search on iOS/mobile devices#1021

Merged
christso merged 2 commits intomainfrom
fix/1018-mobile-search
Apr 9, 2026
Merged

fix(web): fix landing page search on iOS/mobile devices#1021
christso merged 2 commits intomainfrom
fix/1018-mobile-search

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented Apr 9, 2026

Problem

Search on the landing page returns "No results" on iOS devices (Safari and Chrome). Screenshot in #1018 shows "No results for p" on iOS Chrome.

Root Causes & Fixes

1. Wrong WASM MIME type (primary iOS bug)

Cloudflare Pages (Workers Sites) serves wasm.en.pagefind as Content-Type: application/octet-stream. WebKit (iOS Safari/Chrome) is stricter than Blink about response body consumption when WebAssembly.instantiateStreaming() fails a MIME check. The wasm-bindgen fallback then calls response.arrayBuffer() on an already-consumed body, the WASM fails to initialise, and Pagefind returns "no results" for every query. Chrome/Blink is lenient here — explaining why desktop/Android work but iOS doesn't.

Fix: apps/web/public/_headers — serves wasm.* files in /pagefind/ as Content-Type: application/wasm so instantiateStreaming() succeeds on the first attempt.

Note: The user observed results appearing on agentv.dev after the initial report, possibly due to a deployment cycle. The _headers fix ensures the WASM loads reliably on all WebKit browsers going forward.

2. Dialog nested inside <nav> with backdrop-filter

Moved <dialog> to be a sibling of <nav> inside .av-root. Having it inside the backdrop-filter stacking context can cause WebKit to mis-position the dialog in certain versions.

3. Minimal Pagefind UI styling → full Starlight-style theming (parity with allagents)

The original CSS was minimal. Ported the full Starlight-style Pagefind CSS from the allagents sibling repo:

  • Document page icons (SVG mask)
  • Tree diagram connectors for sub-results
  • Hover/focus outlines using agentv's cyan (#06b6d4)
  • Compact result cards with proper spacing

4. Mobile dialog sizing (matches allagents)

Added @media (max-width: 480px) override: margin-top: 1rem; width: 95%; max-height: calc(100vh - 2rem). The original 4rem top margin wasted screen space on small devices.

Before / After (mobile)

Before After
Large 4rem top gap, minimal result styling 1rem top gap, full Starlight result cards with icons and tree connectors

Closes #1018

Two fixes:

1. Add Cloudflare Pages `_headers` to serve `wasm.*.pagefind` with
   `Content-Type: application/wasm`. WebKit (iOS Safari/Chrome) requires
   the correct MIME type for WebAssembly.instantiateStreaming(). Without
   it, WebKit consumes the response body during the failed streaming
   attempt, leaving the ArrayBuffer fallback with an empty buffer.
   The WASM then fails to initialise and all searches return "no results".

2. Move the `<dialog>` element out of the `<nav>` and make it a direct
   sibling. The nav has `backdrop-filter: blur()` which creates a CSS
   stacking context. Nesting a dialog inside such a context can cause
   WebKit to mis-position the dialog's backdrop relative to the nav
   rather than the full viewport.

Closes #1018

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 9, 2026

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5ee3b88
Status: ✅  Deploy successful!
Preview URL: https://d23730f4.agentv.pages.dev
Branch Preview URL: https://fix-1018-mobile-search.agentv.pages.dev

View logs

…g from allagents

- Replace minimal Pagefind CSS with full Starlight-style theming:
  document page icons, tree diagram connectors for sub-results,
  hover/focus outlines, compact result cards matching the docs search
- Add @media (max-width: 480px) override: margin-top: 1rem,
  width: 95%, max-height: calc(100vh - 2rem) so the search frame
  uses most of the screen on small devices instead of leaving
  a large gap at the top (matches allagents implementation)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@christso christso marked this pull request as ready for review April 9, 2026 08:56
@christso christso merged commit 69fba81 into main Apr 9, 2026
4 checks passed
@christso christso deleted the fix/1018-mobile-search branch April 9, 2026 08:56
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.

bug: search does not work in landing page on mobile

1 participant