diff --git a/docs/branch-review-ledger.md b/docs/branch-review-ledger.md index 51602f782..d956b4dc1 100644 --- a/docs/branch-review-ledger.md +++ b/docs/branch-review-ledger.md @@ -794,4 +794,6 @@ This file is append-only. Never rewrite or delete an existing review record; app | 2026-07-24 | cursor/pr-queue-hygiene-72ec | pending-push | PR queue hygiene | Add pr-branch-sync workflow + sync:pr-branches helper; bump postcss to clear npm audit high; document anti-churn guidance in AGENTS/process-hardening/pr-babysit/run-pr. | check:github-actions PASS; docs:check-scripts/index PASS; vitest sync-open-pr-branches 3/3; npm audit high clean; no provider-backed checks run | | 2026-07-24 | codex/apply-phone-layout-to-all-home-pages (PR #1124) | pending | Babysit: ledger dedupe + merge readiness | Before: Static PR failed on exact duplicate ledger rows after main sync. After: removed duplicate rows; squash auto-merge armed. | check:branch-review-ledger PASS; no provider-backed checks run | | 2026-07-25 | cursor/pdf-crop-malformed-repro-9b3e (PR #1176) | c31543f5b5862dbe6911079029f28500a6af2a59 | Run PR sweep: CI fix + threads + drift | Before: GitHub reported DIRTY and Static PR checks failed formatting `docs/outstanding-issues.md` and `tests/pdf-extractor.test.ts`; 0 unresolved threads. After: merged current `origin/main` cleanly and formatted both failing files. | Prettier check pass; `git diff --check` pass; no provider-backed checks run. | +| 2026-07-25 | codex/search-results-filters-20260725 | 88131e7267efd33059766dec80355a9246fbb2bf | Search result filters and document Sources merge-readiness review | APPROVE. No P0-P2 finding after current-main sync. Documents open Sources as an on-screen filtering surface with source-type controls; the shared results ribbon is applied across search pages. Highest residual risk: unusual real-content combinations may alter perceived density, while responsive, forced-colors, focus, and overflow paths are browser-covered. RAG impact: no retrieval behaviour change - UI controls and source browsing only. | `npm run verify:ui` pass 268/268; `npm run verify:cheap` pass (377 files, 3340 passed, 1 skipped); post-sync `npm run verify:pr-local` pass (378 files, 3349 passed, 1 skipped, production build, bundle-secret scan, offline RAG fixtures); `npm run check:production-readiness` pass with OPENAI_SAFETY_IDENTIFIER_SECRET warning; no live/provider-backed app checks run. | | 2026-07-25 | `codex/therapy-page-polish-ad78b4` | `157559aa0678f02de09c14f66d544b62a5138c4a` | Targeted release review: Therapy naming, centred navigation, and white canvas | APPROVE. No P0-P3 findings. The production Therapy route consistently uses the title Therapy, the shared page background token, and a centred overflow-safe section navigation. The latest `origin/main` merge was clean and retained both upstream responsive/home-composer assertions. Highest residual risk is visual drift at an untested browser engine; exact desktop and phone Chromium measurements were stable. | Focused Vitest 40/40; pre-sync `verify:cheap` 378 files / 3342 passed / 1 skipped; pre-sync `verify:ui` passed; integrated runtime, Prettier, lint, and typecheck passed; integrated Vitest was interrupted by the shared heavyweight-test queue after an independent 378-file / 3342-pass run. Required hosted checks must pass on the published exact head before merge. No clinical/provider workflow ran. | +| 2026-07-25 | codex/search-results-filters-20260725 (PR #1184) | 8f74d8bd40810ede34ad4b155973b598c1be0101 | Superseding merge-readiness review after Sources focus repair | APPROVE. Supersedes the 88131e72 row: the automated P2 showed a transient Daily Actions menu item could disconnect before Sources restored focus. Closing Sources now falls back after unmount to the currently rendered action trigger, and the regression requires the visible Documents trigger to own focus. No P0-P2 finding remains. RAG impact: no retrieval behaviour change - UI focus restoration only. | Post-fix isolated production Chromium 1/1; post-current-main local Chromium 1/1; `npm run verify:cheap` pass (378 files, 3350 passed, 1 skipped); targeted Prettier and ESLint pass; required hosted checks must rerun on the published exact head; no live clinical/provider workflow ran. | diff --git a/src/app/(search-app)/documents/search/page.tsx b/src/app/(search-app)/documents/search/page.tsx index 378cd483b..204caee4c 100644 --- a/src/app/(search-app)/documents/search/page.tsx +++ b/src/app/(search-app)/documents/search/page.tsx @@ -9,12 +9,12 @@ export default function DocumentsSearchRoute() { return (

- Indexed library + Indexed sources

Search clinical documents

- Enter a query in the Documents composer to search the live indexed library. Results open the source document at - the matching page and passage. + Enter a query in the Documents composer to search the indexed sources. Results open the source document at the + matching page and passage.

); diff --git a/src/components/ClinicalDashboard.tsx b/src/components/ClinicalDashboard.tsx index 21ac1e487..afd19e124 100644 --- a/src/components/ClinicalDashboard.tsx +++ b/src/components/ClinicalDashboard.tsx @@ -508,6 +508,7 @@ export function ClinicalDashboard({ const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false); const [sidebarCollapsed, setSidebarCollapsed] = useSidebarCollapsed(); const [documentsDrawerOpen, setDocumentsDrawerOpen] = useState(false); + const documentsDrawerReturnFocusRef = useRef(null); const [documentScopeOpen, setDocumentScopeOpen] = useState(false); const [documentsDrawerMode, setDocumentsDrawerMode] = useState("library"); const [uploadDrawerOpen, setUploadDrawerOpen] = useState(false); @@ -2659,18 +2660,13 @@ export function ClinicalDashboard({ } function openDocumentsDrawer(mode: DocumentDrawerMode) { + documentsDrawerReturnFocusRef.current = + document.activeElement instanceof HTMLElement ? document.activeElement : null; closeDashboardTransientSurfaces("documents"); setSearchMode("documents"); setDocumentDrawerStatusFilter("indexed"); setDocumentsDrawerMode(mode); setDocumentsDrawerOpen(true); - if (window.matchMedia("(min-width: 1024px)").matches) { - window.requestAnimationFrame(() => { - document - .getElementById("dashboard-documents-drawer") - ?.scrollIntoView({ block: "start", behavior: resolveScrollBehavior() }); - }); - } } function openRecentDocuments() { @@ -2690,7 +2686,7 @@ export function ClinicalDashboard({ openDocumentsDrawer("library"); setActionNotice({ tone: "warning", - message: "Upload and indexing tools are admin-only. Use the source library to open indexed documents.", + message: "Upload and indexing tools are admin-only. Use Sources to open indexed documents.", }); return; } @@ -3204,7 +3200,7 @@ export function ClinicalDashboard({ ? "Source PDFs" : documentsDrawerIsAdmin ? "Document admin" - : "Source library"; + : "Sources"; const documentsDrawerSummary = dashboardDataLoading ? "Loading indexed document status." : documentsDrawerMode === "recent" @@ -3215,14 +3211,14 @@ export function ClinicalDashboard({ ? `${indexedDocumentTotal.toLocaleString()} indexed documents available.` : "Search and open indexed clinical sources."; const documentsDrawerMobileSummary = dashboardDataLoading - ? "Loading library" + ? "Loading sources" : documentsDrawerMode === "recent" ? "Recent sources" : documentsDrawerMode === "source" ? "PDF sources" : documentsDrawerIsAdmin ? "Admin" - : "Library"; + : "Sources"; const DocumentsDrawerIcon = documentsDrawerMode === "recent" ? Clock3 @@ -3231,7 +3227,7 @@ export function ClinicalDashboard({ : documentsDrawerIsAdmin ? UploadCloud : FolderOpen; - const drawerGroupTitle = uploadDrawerOpen || documentsDrawerIsAdmin ? "Library and admin" : "Sources"; + const drawerGroupTitle = uploadDrawerOpen || documentsDrawerIsAdmin ? "Sources and admin" : "Sources"; // Stable-identity handlers for the React.memo children (StagedAnswerResultSurface, // DocumentSearchResultsPanel). These close over the draft `query` or call the @@ -3247,6 +3243,19 @@ export function ClinicalDashboard({ const handleDocumentTagSearch = useEventCallback(handleTagSearch); const handleOpenRecentDocuments = useEventCallback(openRecentDocuments); const handleOpenSourceLibrary = useEventCallback(openSourceLibrary); + const handleDocumentsDrawerOpenChange = useEventCallback((nextOpen: boolean) => { + setDocumentsDrawerOpen(nextOpen); + if (nextOpen) return; + + const returnTarget = documentsDrawerReturnFocusRef.current; + window.requestAnimationFrame(() => { + const fallbackTarget = Array.from( + document.querySelectorAll('button[aria-haspopup="menu"][aria-label$=" options"]'), + ).find((element) => element.isConnected && element.getClientRects().length > 0); + const focusTarget = returnTarget?.isConnected ? returnTarget : fallbackTarget; + focusTarget?.focus({ preventScroll: true }); + }); + }); const handleOpenSourcePdfBrowser = useEventCallback(openSourcePdfBrowser); const handleCopyAnswer = useEventCallback(() => { copyText("answer", answerRenderModel?.copyText || safeAnswerText || answer?.answer || ""); @@ -3838,8 +3847,9 @@ export function ClinicalDashboard({ summary={documentsDrawerSummary} mobileSummary={documentsDrawerMobileSummary} open={documentsDrawerOpen} - onOpenChange={setDocumentsDrawerOpen} - sheetBreakpoint="lg" + onOpenChange={handleDocumentsDrawerOpenChange} + sheetBreakpoint={documentsDrawerIsAdmin ? "lg" : "all"} + sheetReturnFocusRef={documentsDrawerReturnFocusRef} sheetHeaderLeading={