Skip to content

feat(search): phone toggle for cross-mode matches + tidy sort control#745

Merged
BigSimmo merged 4 commits into
mainfrom
claude/other-matches-toggle-format-kwxm3b
Jul 17, 2026
Merged

feat(search): phone toggle for cross-mode matches + tidy sort control#745
BigSimmo merged 4 commits into
mainfrom
claude/other-matches-toggle-format-kwxm3b

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • On phones, the "Also matches in other modes" panel now renders as a collapsible disclosure, collapsed by default, so it no longer consumes a full stacked grid above the primary results. A count badge and a rotating chevron make it read clearly as a toggle. Tapping the header expands/collapses the cross-mode cards.
  • Desktop is unchanged: the always-open four-column grid still shows, with the "Across Clinical KB" label. The toggle state only governs the narrow-viewport layout (the grid is forced visible at sm: and up), so there is no SSR/hydration flash or desktop layout shift.
  • Restyled the results sort control: the native select chrome is stripped with appearance-none so "Relevance" / "A–Z" render at the same size and weight as the rest of the header band, with "Sort" as a muted label and a fixed custom caret slot (ChevronsUpDown). This fixes the mismatched/oversized "Relevance" text on mobile.

Both are edits to shared components (universal-search-also-matches.tsx, search-results-header-band.tsx), so the behaviour is consistent across every mode that uses them (Services, Forms, Differentials, Medication, Favourites, Documents, Formulation, Answer).

Verification

  • npm run verify:pr-local
  • npm run verify:ui

Verification not run: the full npm run verify:pr-local gate was not run in this sandbox. Checks that were run and passed: npm run typecheck (no errors in the changed source — remaining failures are pre-existing missing test dev-deps), eslint on both changed files, and npx vitest run tests/result-sort.test.ts (3/3).

UI verification not run: the project pins a Playwright browser revision that is not installed in this sandbox (only the pre-installed Chromium 1194 is available), so npm run verify:ui / test:e2e cannot launch. Behaviour was instead verified against the running dev server with the pre-installed Chromium and screenshots — phone (390×844) shows the panel collapsed to a single toggle row that expands to four mode cards with a rotating chevron; desktop (1280×900) is unchanged and the sort control renders cleanly.

Risk and rollout

  • Risk: Low. Presentation-only change to two shared UI components; no data, retrieval, ranking, or answer-contract behaviour changes.
  • Rollback: Revert this commit / branch on the PR.
  • Provider or production effects: None.

Clinical Governance Preflight

Path-based classification flags these components (they live under clinical-dashboard/ and match search) even though the change is purely presentational. Every invariant below is preserved — no ingestion, answer generation, retrieval/ranking, source rendering, document access, privacy, or clinical-output behaviour was changed.

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

  • The phone header remains a real button disclosure on all breakpoints; on desktop it is made inert (sm:cursor-default, panel forced open via sm:grid) so the single accessible-name element required by the existing tests is preserved without duplicating the heading text.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a responsive “Also matches in other modes” panel that can be expanded or collapsed on smaller screens.
    • The panel remains expanded on larger screens and includes accessible disclosure controls.
  • Style
    • Updated the search results sort control with a clearer “Sort” label, improved alignment, and a directional chevron icon.
    • Refined sort control styling for a cleaner, consistent appearance across browsers.

…y sort control

On phones the "Also matches in other modes" panel now renders as a
collapsible disclosure (collapsed by default) with a count badge and a
rotating chevron so it reads clearly as a toggle instead of consuming a
full stacked grid. Desktop keeps the always-open four-column grid, so the
toggle state only governs the narrow-viewport layout.

Also restyles the results sort control: the native <select> chrome is
stripped with appearance-none so "Relevance"/"A–Z" render at the same
size and weight as the rest of the band, with a fixed custom caret slot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H8VhDNjeDXJaVnwufhRKLV
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 32539aab-86e8-4c30-b799-52857070b188

📥 Commits

Reviewing files that changed from the base of the PR and between 2107230 and d27c456.

📒 Files selected for processing (1)
  • src/components/clinical-dashboard/universal-search-also-matches.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/clinical-dashboard/universal-search-also-matches.tsx

📝 Walkthrough

Walkthrough

The clinical dashboard sort control receives a custom icon and updated select styling. The universal search “Also matches” panel gains a responsive, ARIA-connected collapsible header for narrow screens while remaining visible on larger screens.

Changes

Clinical dashboard UI

Layer / File(s) Summary
Result sort control styling
src/components/clinical-dashboard/search-results-header-band.tsx
Adds a styled “Sort” label and ChevronsUpDown indicator, removes native select appearance, and preserves readResultSort handling.
Responsive also-matches disclosure
src/components/clinical-dashboard/universal-search-also-matches.tsx
Adds stateful narrow-screen expansion, generated panel IDs, ARIA attributes, group counts, and rotating ChevronDown behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UniversalSearchAlsoMatches
  participant AlsoMatchesGrid
  User->>UniversalSearchAlsoMatches: Activate the also-matches header
  UniversalSearchAlsoMatches->>UniversalSearchAlsoMatches: Toggle expanded state
  UniversalSearchAlsoMatches->>AlsoMatchesGrid: Apply visibility and layout classes
  AlsoMatchesGrid-->>User: Show or hide mode cards and View all links
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the two main UI changes in the pull request.
Description check ✅ Passed The description follows the required template and includes summary, verification, risk, governance, and notes sections with sufficient detail.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/other-matches-toggle-format-kwxm3b

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 17, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

claude and others added 2 commits July 17, 2026 19:14
Collapse the single-line className cn() call flagged by prettier --check
in CI (Static PR checks / format:check).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H8VhDNjeDXJaVnwufhRKLV
@BigSimmo
BigSimmo marked this pull request as ready for review July 17, 2026 19:33
@BigSimmo
BigSimmo enabled auto-merge July 17, 2026 19:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/clinical-dashboard/universal-search-also-matches.tsx`:
- Around line 73-99: Update the header control around the button’s expanded
state so desktop behavior matches the always-visible panel: suppress pointer
interaction at the sm breakpoint and ensure accessibility state reports expanded
on desktop, using the component’s existing responsive state approach or
rendering a non-interactive desktop header while preserving the mobile toggle
behavior.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 672c0820-1053-489b-850f-371c9e08c04f

📥 Commits

Reviewing files that changed from the base of the PR and between b04c95f and 2107230.

📒 Files selected for processing (2)
  • src/components/clinical-dashboard/search-results-header-band.tsx
  • src/components/clinical-dashboard/universal-search-also-matches.tsx

Comment thread src/components/clinical-dashboard/universal-search-also-matches.tsx
…always open

The disclosure button reported aria-expanded=false on desktop even though
the sm:grid panel is always visible, and stayed clickable/focusable with no
visible effect. Track the sm breakpoint via matchMedia and, on desktop,
report aria-expanded=true, drop the button from the tab order (tabIndex -1),
and add sm:pointer-events-none so screen-reader and keyboard users see the
header as static copy rather than a collapsed control. Phone behaviour is
unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H8VhDNjeDXJaVnwufhRKLV
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

@BigSimmo
BigSimmo merged commit 85ae254 into main Jul 17, 2026
24 checks passed
@BigSimmo
BigSimmo deleted the claude/other-matches-toggle-format-kwxm3b branch July 17, 2026 19:49
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.

2 participants