Skip to content

fix(docs): re-initialize search after Astro View Transitions#856

Merged
diberry merged 2 commits intodevfrom
squad/713-docs-search-view-transitions
Apr 7, 2026
Merged

fix(docs): re-initialize search after Astro View Transitions#856
diberry merged 2 commits intodevfrom
squad/713-docs-search-view-transitions

Conversation

@diberry
Copy link
Copy Markdown
Collaborator

@diberry diberry commented Apr 5, 2026

Cherry-picks the fix from #713. Re-initializes PageFind search after Astro View Transitions so search works after navigation.

Original author: @CarlosSardo
Closes #712

Part of stale PR triage (diberry#137)

Copilot AI review requested due to automatic review settings April 5, 2026 17:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

🟢 Impact Analysis — PR #856

Risk tier: 🟢 LOW

📊 Summary

Metric Count
Files changed 2
Files added 0
Files modified 2
Files deleted 0
Modules touched 1

🎯 Risk Factors

  • 2 files changed (≤5 → LOW)
  • 1 module(s) touched (≤1 → LOW)

📦 Modules Affected

docs (2 files)
  • docs/src/components/Search.astro
  • docs/tests/search.spec.mjs

This report is generated automatically for every PR. See #733 for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 33414a3

PR Scope: 🔧 Infrastructure

⚠️ 4 item(s) to address before review

Status Check Details
Single commit 3 commits — consider squashing before review
Not in draft Ready for review
Branch up to date Up to date with dev
Copilot review No Copilot review yet — it may still be processing
Changeset present No source files changed — changeset not required
Scope clean No .squad/ or docs/proposals/ files
No merge conflicts No merge conflicts
Copilot threads resolved 2 unresolved Copilot thread(s) — fix and resolve before merging
CI passing 4 check(s) still running

Files Changed (2 files, +149 −43)

File +/−
docs/src/components/Search.astro +78 −43
docs/tests/search.spec.mjs +71 −0

Total: +149 −43


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cherry-picks the docs-site fix from #713 to keep Pagefind search working after Astro View Transitions by re-initializing DOM references and event handlers after client-side navigation.

Changes:

  • Refactors Search.astro to (re)bind DOM lookups and listeners via an initSearch() run on astro:page-load.
  • Adds Playwright regression coverage to ensure search continues working after navigating via a search result (View Transition).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/src/components/Search.astro Re-initializes search DOM refs/listeners after View Transitions; ensures Pagefind instance persists across navigations.
docs/tests/search.spec.mjs Adds regression tests validating search still opens/works after View Transition navigation.

Comment thread docs/src/components/Search.astro
Comment thread docs/tests/search.spec.mjs
Comment thread docs/tests/search.spec.mjs
@diberry diberry force-pushed the squad/713-docs-search-view-transitions branch from 77493c1 to b96ea74 Compare April 6, 2026 04:00
@diberry diberry force-pushed the squad/713-docs-search-view-transitions branch from 33414a3 to f296ff4 Compare April 6, 2026 14:56
Fixes #712 — docs site search becomes non-functional after navigating via
Astro View Transitions.

Re-initializes DOM element references via the astro:page-load event, which
fires on initial load and after each client-side View Transition. Event
listeners are properly torn down and re-attached to fresh DOM references.

Includes 2 Playwright regression tests for post-navigation search behavior:
- Search works after navigating via search result
- Ctrl+K opens search after View Transition navigation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry diberry force-pushed the squad/713-docs-search-view-transitions branch from f296ff4 to 9649e24 Compare April 6, 2026 16:08
Copy link
Copy Markdown
Collaborator

@tamirdresher tamirdresher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by @tamirdresher — reviewed diff, CI green, changes are clean and well-tested. cc @diberry

@diberry diberry merged commit 9f1e574 into dev Apr 7, 2026
11 checks passed
tamirdresher pushed a commit that referenced this pull request Apr 21, 2026
Fixes #712 — docs site search becomes non-functional after navigating via
Astro View Transitions.

Re-initializes DOM element references via the astro:page-load event, which
fires on initial load and after each client-side View Transition. Event
listeners are properly torn down and re-attached to fresh DOM references.

Includes 2 Playwright regression tests for post-navigation search behavior:
- Search works after navigating via search result
- Ctrl+K opens search after View Transition navigation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Docs search stops working after navigating via search result (View Transitions)

4 participants