Skip to content

Improve “Also matches in other modes” phone spacing and tap target - #1604

Closed
BigSimmo wants to merge 11 commits into
mainfrom
cursor/also-matches-modes-spacing-67a5
Closed

Improve “Also matches in other modes” phone spacing and tap target#1604
BigSimmo wants to merge 11 commits into
mainfrom
cursor/also-matches-modes-spacing-67a5

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Restyle the collapsed Also matches in other modes disclosure as a raised card (matching library rows) instead of a flat bar flush against the phone bottom edge.
  • Give the phone toggle a full min-h-tap (48px) hit target, leading Layers icon, count badge, and short subtitle so it is easier to find and tap.
  • Add phone bottom margin (max-sm:mb-4) as content spacing below the last interactive section (not a chrome/dock reserve restore — those stay 0rem when scroll-hidden).
  • Review follow-ups addressed:
    • Restore motion-safe:animate-fade-up entrance motion.
    • Keep finished-empty / pending / collapsed count badge as (no literal 0).
    • Exclude phone subtitle (and indeterminate badge) from the disclosure accessible name.
    • Top-align the 48px “View all” hit box with the mode label (items-start + pt-0.5).
    • Preserve raised-card look in prescribing via horizontal inset instead of flattening radius/shadow.
    • Include vertical margins in the answer overflow smoke budget so mb-4 does not steal the 24px rounding slack.

Verification

  • npm run test:focused -- --files src/components/clinical-dashboard/universal-search-also-matches.tsx50 passed
  • npm run test -- --run tests/audit-navigation-auth-regressions.test.ts tests/favourites-auth-gate.test.ts tests/style-contract-registry.test.ts27 passed (re-confirmed after main merge: style + audit 26 passed)
  • npx eslint src/components/clinical-dashboard/universal-search-also-matches.tsx --max-warnings 0 — clean
  • npm run test:e2e -- tests/ui-universal-search.spec.ts --project=chromium --grep "loads submitted cross-mode matches on phones only after expansion"1 passed
  • npm run test:e2e -- tests/ui-smoke.spec.ts --project=chromium --grep "phone short answer stays top-aligned with no phantom scroll into black"1 passed (✓ … (965ms))
  • Phone visual check /forms?q=acamprosate&run=1 (390×844): raised card, Layers icon, subtitle, fade-up class, marginBottom: 16px
  • Phone visual check /?mode=prescribing&q=acamprosate&run=1 (390×844): raised card retained (border-radius: 16px, inset shadow, horizontal inset)
  • Expanded disclosure: accessible name matches /Also matches in other modes/ and does not match /related modes/ / subtitle; count badge shows 2 when matches exist
  • npm run verify:pr-local — not stacked after focused + targeted Chromium proof above

Risk and rollout

  • Risk: Low — presentation-only change to an existing disclosure; expand/search deferral behaviour unchanged.
  • Rollback: Revert the branch commits.
  • Provider or production effects: None

Notes

Desktop (sm+) behaviour is unchanged: the panel stays always-open and the header remains inert. Prescribing phones keep the raised card via horizontal inset rather than the old edge-to-edge flatten.

Also matches collapsed on Forms phone
Also matches expanded on Forms phone
Also matches raised card retained on Prescribing phone

To show artifacts inline, enable in settings.

Open in WebOpen in Cursor

Summary by CodeRabbit

  • New Features

    • Added an “Also matches in other modes” section with clearer related-mode counts and improved phone/desktop behavior.
    • Updated the results cards and header layout for a cleaner, more prominent browsing experience.
  • Bug Fixes

    • Improved mobile spacing and safe-area handling so related content displays correctly on phones.
    • Refined layout and overflow behavior across search and result screens for more consistent scrolling and presentation.

Restyle the collapsed “Also matches in other modes” disclosure as a
raised card with a 48px tap target, leading icon, and clearer subtitle
so it sits above the home-indicator edge instead of as a flush bottom bar.
@coderabbitai

coderabbitaiBot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR refines the related-matches UI, preserves its mobile card styling, removes its style-contract exemption, and updates UI smoke tests for responsive geometry, navigation, rail behavior, and document search actions.

Changes

Responsive related-matches UI

Layer / File(s)Summary
Related-matches disclosure and card presentation
src/components/clinical-dashboard/universal-search-also-matches.tsx, src/app/globals.css, tests/helpers/style-contracts.ts
The component adds pluralized related-mode labels, phone-specific subtitles and badges, revised disclosure controls, and updated result-card styling. Mobile CSS preserves the raised related-matches card and applies safe-area margins. The style-contract exemption is removed.
Responsive layout and interaction validation
tests/ui-smoke.spec.ts
Phone overlay dismissal, related-matches overflow calculations, edge-dock bounds, and cross-mode rail assertions are updated.
Document search layout test maintenance
tests/ui-smoke.spec.ts
Document search action checks use a fixed 14px font-size assertion. The document-frame sizing helper and its test are removed.

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

Possibly related PRs

  • BigSimmo/Database#471: Directly changes the same medication “also matches” UI and related styling tests.
  • BigSimmo/Database#745: Extends the same UniversalSearchAlsoMatches component with responsive disclosure and messaging changes.
  • BigSimmo/Database#1305: Changes validation behavior for the medication-also-matches styling.

Suggested reviewers:claude, copilot, cursoragent

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly summarizes the main phone UI changes to spacing and tap-target size.
Description check✅ PassedThe description follows the template with clear summary, verification evidence, risk, rollback, and provider-effect details.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@supabase

supabaseBot commented Aug 4, 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 ↗︎.

@github-actions

github-actionsBot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 3 failed job(s):

  • Production UI criticalneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #8077 (cancelled).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

cursoragentand others added 4 commits August 4, 2026 11:19
Give the disclosure a bit more clearance above the home indicator
when scroll-hidden dock reserve collapses to zero.
The icon sits inside a decorative chevron wrapper and needs an explicit
aria-hidden on the Lucide component for the local eslint rule.
@BigSimmo
BigSimmo marked this pull request as ready for review August 5, 2026 05:38
devin-ai-integration[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

BigSimmoand others added 6 commits August 5, 2026 13:55
Restore fade-up entrance motion, keep empty counts as ellipsis, hide the
phone subtitle from the disclosure accessible name, and top-align the
48px View-all hit box with the mode label. Preserve raised-card styling
in prescribing by insetting instead of flattening. Count phone bottom
margin in the answer overflow smoke budget so clearance is not stolen
from the rounding slack.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Prescribing also-matches is now margin-inset only (no unlayered visual
border/shadow override), so the cascade-layer inventory no longer lists
the class and the exemption entry must go.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Point the inventory walk-back note at a current multi-line selector
list after medication-also-matches stopped sharing a visual rule block.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Prefer this branch's larger phone chevron hit target and the matching
ui-smoke overflow budget over main's pre-redesign chrome.

@devin-ai-integrationdevin-ai-integrationBot 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.

Devin Review found 1 new potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment on lines +1540 to +1543
await page
.locator(".fixed.inset-0.z-\\[100\\]")
.first()
.click({ position: { x: 8, y: 8 } });

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.

🔴 Recently merged browser-test updates were undone, so the browser test suite now fails

Updates that had already landed on the main line are wiped out again (tests/ui-smoke.spec.ts:1540-1543 restores a stale backdrop selector) when the branch was merged, so the browser test run fails and several checks that were just added disappear.
Impact: The Chromium browser check goes red on this branch and coverage that was shipped days ago silently vanishes.

Merge commit c593e62 took the branch side of tests/ui-smoke.spec.ts, discarding every change from #1616

git diff f4448f8c..08595cc0 -- tests/ui-smoke.spec.ts (PR #1616, the merge base) and git diff 08595cc0..HEAD -- tests/ui-smoke.spec.ts are exact inverses: the merge resolved the file entirely to the pre-#1616 version. Concretely, the restored assertions no longer match the current source:

  • tests/ui-smoke.spec.ts:1540-1543 clicks .fixed.inset-0.z-\[100\], but the sheet backdrop is now z-[var(--z-modal)] (src/components/ui/sheet.tsx:342), so the locator matches nothing and the click times out. ui: complete and activate the v2 design system #1616 replaced it with modeSheet.locator("..").
  • tests/ui-smoke.spec.ts:2488-2490 targets cross-mode-links-rail and asserts md:flex, but at 1280px the answer surface renders variant="responsive-compact" (src/components/clinical-dashboard/answer-result-surface.tsx:307), where cross-mode-links-rail is the md:hidden phone rail and the wide rail is cross-mode-links-card-rail (src/components/clinical-dashboard/cross-mode-links.tsx:230-246). toBeVisible() fails.
  • tests/ui-smoke.spec.ts:3413 re-hardcodes actionFontSize === "14px", but the actions use !text-sm and v2 sets --text-sm: 0.8125rem (13px) in src/app/ckb-v2-tokens.css:64.
  • The document frame stretches canvas and native owners at phone and desktop test plus expectDocumentOwnerFillsFrame, and the 48px tap-target assertions on the cross-mode rail, are deleted outright.
  • The scroll-budget comments/values (permittedOverflow, maxOffset < 200, postCollapseMaxOffset <= 72) are reverted to the pre-ui: complete and activate the v2 design system #1616 numbers.
Prompt for agents
The merge commit c593e624 ("merge origin/main: keep also-matches phone tap-target redesign") resolved tests/ui-smoke.spec.ts entirely to the branch side, discarding every change PR #1616 made to that file on main. Verify with: git diff f4448f8c..08595cc0 -- tests/ui-smoke.spec.ts versus git diff 08595cc0..HEAD -- tests/ui-smoke.spec.ts — they are inverses. Redo the merge for this file by taking main's version (08595cc0) as the base and re-applying only this PR's intended edit (including vertical margins in the alsoMatchesHeight measurement in the 'phone short answer stays top-aligned' test, and any budget adjustment justified by the new max-sm:mb-4). Restored stale assertions that no longer match the source: the '.fixed.inset-0.z-[100]' backdrop locator (sheet backdrop is now z-[var(--z-modal)]), 'cross-mode-links-rail'/'md:flex' in the desktop cross-mode-links test (the wide rail is 'cross-mode-links-card-rail' under the responsive-compact variant), the hardcoded '14px' action font size (--text-sm is now 0.8125rem), plus the deleted 'document frame stretches canvas and native owners' test, expectDocumentOwnerFillsFrame helper, and the 48px tap-target assertions.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/clinical-dashboard/universal-search-also-matches.tsx (1)

138-151: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Render static header content on desktop.

When isWide is true, this remains a native button. tabIndex={-1} removes sequential keyboard focus, and pointer-events-none blocks pointer input. Screen reader navigation can still expose and activate a button whose handler has no effect.

Render a non-interactive header at sm and render the disclosure button only below sm. This keeps the desktop header inert for all users.

🤖 Prompt for 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.
In `@src/components/clinical-dashboard/universal-search-also-matches.tsx` around
lines 138 - 151, Update the header rendering around the disclosure button so
`isWide` renders static, non-interactive content instead of a native button,
while narrower layouts continue rendering the existing disclosure button and
toggle behavior. Preserve the current desktop styling and panel relationship,
but remove the desktop-only button semantics, `tabIndex`, and inert click
handler from the wide variant.
🧹 Nitpick comments (1)
src/app/globals.css (1)

1667-1669: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace literal spacing values with existing theme tokens.

Lines 1668-1669 introduce 1rem and 0.25rem as direct design values. Use the repository’s @theme spacing tokens in both the fallback gutter and the safe-area calculation.

As per coding guidelines, “Use Tailwind 4 @theme tokens in src/app/globals.css … rather than introducing hardcoded design values.”

🤖 Prompt for 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.
In `@src/app/globals.css` around lines 1667 - 1669, Update the
.medication-also-matches margin-left and margin-right declarations to replace
both literal 1rem and 0.25rem values with the corresponding existing `@theme`
spacing tokens, preserving the current max() and safe-area calculation behavior.

Source: Coding guidelines

🤖 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.
Outside diff comments:
In `@src/components/clinical-dashboard/universal-search-also-matches.tsx`:
- Around line 138-151: Update the header rendering around the disclosure button
so `isWide` renders static, non-interactive content instead of a native button,
while narrower layouts continue rendering the existing disclosure button and
toggle behavior. Preserve the current desktop styling and panel relationship,
but remove the desktop-only button semantics, `tabIndex`, and inert click
handler from the wide variant.
---
Nitpick comments:
In `@src/app/globals.css`:
- Around line 1667-1669: Update the .medication-also-matches margin-left and
margin-right declarations to replace both literal 1rem and 0.25rem values with
the corresponding existing `@theme` spacing tokens, preserving the current max()
and safe-area calculation behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 14d19d58-fa93-47c1-a34a-47d3afc4c353

📥 Commits

Reviewing files that changed from the base of the PR and between 08595cc and c593e62.

📒 Files selected for processing (4)
  • src/app/globals.css
  • src/components/clinical-dashboard/universal-search-also-matches.tsx
  • tests/helpers/style-contracts.ts
  • tests/ui-smoke.spec.ts

@BigSimmoClaude

Copy link
Copy Markdown
OwnerAuthor

Closing in favour of #1629, which carries this PR's work forward on top of current main. Nothing is lost — recording where each piece went.

Why this branch could not simply be fixed forward. Merge commit c593e624 resolved tests/ui-smoke.spec.ts entirely to the branch side, discarding every change #1616 had already landed on main. That is not a speculative finding: Production UI critical on head c593e62 failed with

✘ document search mode lists matching documents and result actions @critical
Expected: "14px" Received: "13px" at tests/ui-smoke.spec.ts:3413

— the branch had re-hardcoded 14px while --text-sm is now 0.8125rem. Alongside that, the document frame stretches canvas and native owners test, the expectDocumentOwnerFillsFrame helper, and the 48px cross-mode tap-target assertions were deleted outright, and the scroll-budget values reverted to their pre-#1616 numbers. Re-merging 11 commits around a poisoned test file costs more than re-applying the real change, which turned out to be three files.

What was salvaged (verified applying cleanly onto current main):

FileStatus
src/components/clinical-dashboard/universal-search-also-matches.tsxcarried over in full — raised card, min-h-tap toggle, Layers icon, count badge, subtitle excluded from the accessible name, max-sm:mb-4 clearance
src/app/globals.csscarried over
tests/helpers/style-contracts.tscarried over
tests/ui-smoke.spec.tsonly the intended edit — vertical margins included in the alsoMatchesHeight measurement — re-applied to main's current version. +13/−2 instead of +61/−152

One defect fixed rather than inherited. The desktop "Across Clinical KB" label used --text-soft, a deprecated alias of --decoration-soft that the design system pins below 4.5:1 and explicitly bans on text nodes (docs/design-system/GATES.md §1). That is what made Static PR checks red here (textSoftConsumers increased from 0 to 1). #1629 uses --text-muted, matching the sibling subtitle, and the ratchet reports --text-soft consumers 0.

Verification on #1629:npm run test — 504 files passed, 5327 passed / 4 skipped, 0 failed; check:design-system-contract passes; eslint clean; prettier --check . clean repo-wide.

The branch cursor/also-matches-modes-spacing-67a5 is being kept, not deleted — the review history and the three earlier review-hardening rounds (fade-up motion, badge over a literal 0, accessible-name exclusion, top-aligned hit box, prescribing inset) remain readable here and are reflected in the salvaged component.


Generated by Claude Code

@BigSimmoBigSimmo closed this Aug 5, 2026
BigSimmo added a commit that referenced this pull request Aug 5, 2026
… (#1629)
Re-applies PR #1604's intended change on top of current main. That PR's
merge commit c593e62 resolved tests/ui-smoke.spec.ts entirely to the
branch side, discarding every change #1616 had already landed on main --
CI confirmed it, failing on a re-hardcoded 14px action font size against
the current --text-sm of 0.8125rem.
Only the three files carrying real work are carried over:
- universal-search-also-matches.tsx: raised card, min-h-tap toggle with
Layers icon, count badge and subtitle, subtitle excluded from the
accessible name, phone bottom clearance.
- globals.css and tests/helpers/style-contracts.ts: supporting tokens and
contract entries.
tests/ui-smoke.spec.ts gets only the one edit #1604 actually intended --
including vertical margins in the alsoMatchesHeight measurement, so the
phone bottom margin does not eat the phantom-scroll budget. It is applied
to main's current version of that test, so the +61/-152 revert is gone
and the file stays at +13/-2.
Also fixes a defect the original carried: the desktop "Across Clinical KB"
label used --text-soft, a deprecated alias of --decoration-soft that the
design system pins below 4.5:1 and bans on text nodes. It now uses
--text-muted, matching the sibling subtitle. This is what made #1604 red
on check:design-system-contract.
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for freeto 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

@BigSimmo@cursoragent