Title: Docs search stops working after navigating via search result (View Transitions) · Issue #712 · github/squad · GitHub
Open Graph Title: Docs search stops working after navigating via search result (View Transitions) · Issue #712 · github/squad
X Title: Docs search stops working after navigating via search result (View Transitions) · Issue #712 · github/squad
Description: Description The docs website search breaks after navigating to a search result. On first page load, clicking the search textbox works — the user can type and search. After clicking a search result (which triggers an Astro View Transition...
Open Graph Description: Description The docs website search breaks after navigating to a search result. On first page load, clicking the search textbox works — the user can type and search. After clicking a search result ...
X Description: Description The docs website search breaks after navigating to a search result. On first page load, clicking the search textbox works — the user can type and search. After clicking a search result ...
Opengraph URL: https://github.com/github/squad/issues/712
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Docs search stops working after navigating via search result (View Transitions)","articleBody":"## Description\n\nThe docs website search breaks after navigating to a search result. On first page load, clicking the search textbox works — the user can type and search. After clicking a search result (which triggers an Astro View Transition), the search textbox can no longer be focused or typed into. The only workaround is a hard refresh (Ctrl+F5).\n\n## Steps to Reproduce\n\n1. Navigate to the docs site (e.g., https://bradygaster.github.io/squad/)\n2. Click the search button or press Ctrl+K\n3. Type a query (e.g., \"agent\") and wait for results\n4. Click on any search result to navigate to that page\n5. Try to click the search button again or press Ctrl+K\n6. **Expected:** Search modal opens and the input is focused\n7. **Actual:** Nothing happens — search is completely non-functional\n\n## Root Cause\n\nThe `Search.astro` component uses a `\u003cscript define:vars>` block that captures DOM element references (`searchBtn`, `searchModal`, `searchInput`, etc.) and attaches event listeners **once** at initial script execution time. \n\nThe docs site uses Astro View Transitions (`\u003cViewTransitions />` in `BaseLayout.astro`). After a client-side navigation, Astro swaps the DOM — replacing all the elements. The old JavaScript references now point to **detached DOM nodes**, so clicks/keyboard shortcuts silently do nothing.\n\nOther components in the docs site (theme toggle, copy buttons) already handle this correctly by using `document.addEventListener('astro:page-load', initFunction)`, but the search component was missing this pattern.\n\n## Environment\n\n- Astro 5.x with View Transitions enabled\n- Pagefind search integration\n- All browsers affected (View Transitions are the root cause, not browser-specific)","author":{"url":"https://github.com/CarlosSardo","@type":"Person","name":"CarlosSardo"},"datePublished":"2026-03-31T09:11:32Z","url":"https://github.com/github/squad/issues/712"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:65e6627c-35b8-1b82-d378-5aea65282bcc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D972:63A36:C8D18:10DF0E:6B015D6A |
| html-safe-nonce | 97300b53a151b41c044458816b60abbf99250620866a6b063c2d8573208c51c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTcyOjYzQTM2OkM4RDE4OjEwREYwRTo2QjAxNUQ2QSIsInZpc2l0b3JfaWQiOiI3OTc1NjgzMzA5MDE3NTg3MDUwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 82397e1c3885b9a68e44e142dce1a5dbdd83a4cb5d1f87f10449e81da61ba26c |
| hovercard-subject-tag | issue:4177446977 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/squad/712/issue_layout |
| twitter:image | https://opengraph.githubassets.com/141173ccb53cd692f0171067628c6c67d541d3039c7c44de3abb6287852a29a0/github/squad/issues/712 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/141173ccb53cd692f0171067628c6c67d541d3039c7c44de3abb6287852a29a0/github/squad/issues/712 |
| og:image:alt | Description The docs website search breaks after navigating to a search result. On first page load, clicking the search textbox works — the user can type and search. After clicking a search result ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CarlosSardo |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/github/squad git https://github.com/github/squad.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 1151205052 |
| octolytics-dimension-repository_nwo | github/squad |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1151205052 |
| octolytics-dimension-repository_network_root_nwo | github/squad |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width