Skip to content

Fix mobile Answer edge dock hide and reveal#1192

Merged
BigSimmo merged 100 commits into
mainfrom
cursor/fix-mobile-composer-edge-scroll-5b1d
Jul 25, 2026
Merged

Fix mobile Answer edge dock hide and reveal#1192
BigSimmo merged 100 commits into
mainfrom
cursor/fix-mobile-composer-edge-scroll-5b1d

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix phone Answer-mode edge dock hide/reveal: synchronize header + bottom composer chrome, clear stale composerChromeFocused when the phone dock tears down without blur, and refuse near-bottom reserve-only hides that would clamp content under the finger.
  • Distinguish layout/range clamps from genuine upward scroll intent; bind composer autofocus retries so answer submit does not re-fire focus into a hidden dock.
  • Extend focused unit + Playwright coverage for clamp/reserve hide gates and compact answer chrome behavior.

RAG impact: no retrieval behaviour change — search-chrome / mobile dock UX only; ranking, retrieval, and answer generation are untouched.

Verification

  • Focused: node scripts/run-vitest.mjs run tests/use-hide-on-scroll.test.ts tests/mobile-composer-reserve.test.ts (28/28) before and after merging current main
  • Prior tip retained Chromium UI / design-sweep proofs recorded in the branch-review ledger
  • Verification not run this pass: full npm run verify:pr-local / npm run verify:ui not re-run after the latest main merge; hosted CI will re-validate on this head
  • UI verification not run this pass: no new headed phone matrix after the main sync

Risk and rollout

  • Risk: medium — touches shared phone search chrome hide/reveal, focus pinning, and reserve-collapse scroll math used by Answer and other bottom-dock modes
  • Rollback: after squash-merge, revert the single squash commit on main; no schema/migration dependency
  • Provider or production effects: None

Clinical Governance Preflight

  • 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

  • Prior review P1 (focus latch after dock teardown) and P2 (reserve-only near-bottom clamp) were fixed in 5b5ecf405 and retained through the main sync.
  • Residual non-blocking: non-answer focus=1 autofocus remains broader than Answer-mode; earlier document-detail double-header notes are out of this PR's Answer-dock scope.

Summary by CodeRabbit

  • Improvements
    • Improved mobile scrolling so the universal header and edge “answer” dock hide/reveal and stay in sync across collapse scenarios.
    • Refined collapse behavior to correctly handle scroll-range clamps and reserve-only overlays, preventing unintended chrome reveals.
    • Improved composer focus management (including when using focus=1) with safer autofocus pinning/cleanup to avoid accidental blur.
  • Tests
    • Added a new phone end-to-end smoke test for the synchronized hide/show flow and focused/scroll restoration.
    • Expanded unit coverage for hide/reveal logic and made one existing scroll assertion more deterministic.

cursoragent and others added 2 commits July 25, 2026 04:00
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@supabase

supabase Bot commented Jul 25, 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 ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@BigSimmo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c3cf7ff-0596-4113-8f5d-4604bed0036e

📥 Commits

Reviewing files that changed from the base of the PR and between 136f38a and 68833dd.

📒 Files selected for processing (1)
  • docs/branch-review-ledger.md
📝 Walkthrough

Walkthrough

The PR adds geometry-aware mobile chrome collapse handling, distinguishes in-flow and reserve-only behavior, synchronizes header and composer pinning, refines composer autofocus retention, and adds unit, UI smoke, contract, and review-ledger coverage.

Changes

Mobile chrome behavior

Layer / File(s) Summary
Geometry-aware collapse decisions
src/components/clinical-dashboard/use-hide-on-scroll.ts, tests/use-hide-on-scroll.test.ts, docs/search-chrome-behaviour.md
Collapse decisions now use collapseKind, previousMaxOffset, range-shrink detection, and kind-specific safe-runway calculations.
Metrics reporting integration
src/components/clinical-dashboard/use-hide-on-scroll.ts, src/components/ClinicalDashboard.tsx, src/components/clinical-dashboard/global-search-shell.tsx, src/components/clinical-dashboard/mobile-composer-reserve.ts, tests/mobile-composer-reserve.test.ts
Scroll reporting now propagates readChromeCollapseMetrics, tracks prior maximum offsets, and resets geometry state when reporting context changes.
Pinned chrome and composer focus synchronization
src/components/ClinicalDashboard.tsx, src/components/clinical-dashboard/master-search-header.tsx, src/components/clinical-dashboard/focus-composer-input.ts
Autofocus considers answer-mode submission state and retained targets, while header and composer visibility share open-surface and focus pinning state.
Mobile behavior verification and review records
tests/ui-smoke.spec.ts, tests/mobile-composer-reserve.test.ts, docs/branch-review-ledger.md
UI and contract coverage verifies dock geometry, synchronized hide/show, reserve height, and focus restoration; branch review results are recorded.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ScrollContainer
  participant phoneScrollHide
  participant computeScrollHideUpdate
  participant HeaderAndComposer
  User->>ScrollContainer: scroll or focus main
  ScrollContainer->>phoneScrollHide: report offset, maxOffset, and collapse metrics
  phoneScrollHide->>computeScrollHideUpdate: evaluate collapse kind and prior max offset
  computeScrollHideUpdate->>HeaderAndComposer: update synchronized hidden state
  HeaderAndComposer->>User: hide or reveal header and composer
Loading

Possibly related PRs

Suggested labels: codex

Suggested reviewers: cursoragent, claude

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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 clearly summarizes the main change: fixing mobile Answer edge dock hide/reveal behavior.
Description check ✅ Passed The description matches the required template and includes summary, verification, risk, governance preflight, and notes.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-mobile-composer-edge-scroll-5b1d

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

CI triage

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

  • Production UIneeds 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 #5615 (success).

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

github-actions Bot and others added 21 commits July 25, 2026 04:17
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…scroll-5b1d' into cursor/fix-mobile-composer-edge-scroll-5b1d

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor cursor Bot changed the title Fix mobile Answer chrome edge-to-edge scroll behavior Fix mobile Answer edge dock hide and reveal Jul 25, 2026
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
BigSimmo and others added 13 commits July 26, 2026 00:58
On a starved CI renderer the single upward scrollTop write coalesced
into the trailing bottom-clamp evaluation, and the shrinking-range hold
rebased it away as geometry feedback, so the reveal never fired. A real
drag always emits follow-up events; model that with two separated
upward steps that each yield frames.
…shold

RAF debouncing coalesces a layout-clamp scroll event with any immediately
following user scroll into one RAF evaluation. The hook reads the final
offset (newMaxOffset - userScroll) but lastMaxOffsetRef still holds the
pre-collapse maximum so the clamp detection incorrectly fires:

  lastOffset (V) > newMaxOffset (V-72)  ← old position above new max
  offset   (V-96) < lastOffset (V)      ← apparent upward movement
  maxOffset (V-72) < previousMaxOffset (V) ← range shrank

All three conditions are true even though the upward movement includes a
genuine 24px user scroll on top of the geometry-driven clamp.

Guard the clamp detection with offset >= maxOffset - revealIntentDistance:
only treat the movement as pure geometry feedback when the net position
lands within revealIntentDistance (12px) of the new bottom edge. If the
combined offset is already more than 12px below the new max the user has
supplied enough upward intent to reveal regardless of the clamp.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…dger

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…scroll-5b1d' into cursor/fix-mobile-composer-edge-scroll-5b1d

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…poser-edge-scroll-5b1d

# Conflicts:
#	src/components/clinical-dashboard/global-search-shell.tsx

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…scroll-5b1d' into cursor/fix-mobile-composer-edge-scroll-5b1d

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…poser-edge-scroll-5b1d

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Merging current main into this branch let the union driver append two
records that both sides already carried, which fails
check:branch-review-ledger. Both copies of each record were byte
identical, so the later copy goes and the unique record set is
unchanged at 938.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

@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: 2

🤖 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 `@docs/branch-review-ledger.md`:
- Line 991: Correct the future-dated audit record dates in
docs/branch-review-ledger.md at lines 991, 994, 996, and 1000 to the current
date, July 25, 2026, unless the entries are intentionally deferred until the
work occurs; update all four records consistently.

In `@tests/ui-smoke.spec.ts`:
- Around line 3865-3879: Replace the direct scrollTop and RAF logic in the
reveal loop with the existing scrollPrimarySurface helper for both upward steps,
preserving the settledBottomOffset-based targets and 24/48 rise sequence. Ensure
each helper call dispatches the scroll event and waits for the browser task as
intended.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: def393df-104f-45ef-a45a-b943ea7e68a6

📥 Commits

Reviewing files that changed from the base of the PR and between ac28e06 and 136f38a.

📒 Files selected for processing (8)
  • docs/branch-review-ledger.md
  • docs/search-chrome-behaviour.md
  • src/components/ClinicalDashboard.tsx
  • src/components/clinical-dashboard/global-search-shell.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/use-hide-on-scroll.ts
  • tests/ui-smoke.spec.ts
  • tests/use-hide-on-scroll.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/components/clinical-dashboard/global-search-shell.tsx
  • docs/search-chrome-behaviour.md
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/use-hide-on-scroll.ts

Comment thread docs/branch-review-ledger.md
Comment thread tests/ui-smoke.spec.ts
@coderabbitai

coderabbitai Bot commented Jul 25, 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.

Cannot run autofix: This PR has merge conflicts.

Please resolve the conflicts with the base branch and try again.

Alternatively, use @coderabbitai resolve merge conflict to automatically resolve the conflicts.

@coderabbitai

coderabbitai Bot commented Jul 25, 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.

⚠️ Branch updated during autofix.

The branch was updated while autofix was in progress. Please try again.

@coderabbitai

coderabbitai Bot commented Jul 25, 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.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/ui-smoke.spec.ts

Commit: 2597dd305fd61e4e16166cccd109ff6f8eae0a33

The changes have been pushed to the cursor/fix-mobile-composer-edge-scroll-5b1d branch.

Time taken: 1m 44s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@BigSimmo
BigSimmo merged commit c4d5f47 into main Jul 25, 2026
18 checks passed
@BigSimmo
BigSimmo deleted the cursor/fix-mobile-composer-edge-scroll-5b1d branch July 25, 2026 18:22
BigSimmo added a commit that referenced this pull request Jul 25, 2026
BigSimmo added a commit that referenced this pull request Jul 25, 2026
#1224 and the #1192 landing (#1232)

* docs(ledger): batch the appends from PRs #1206, #1207, #1210, #1211 and #1224

Five open PRs each append review records to docs/branch-review-ledger.md
and nothing else. Each one has to be synced against main and carried
through a full CI cycle, and every sync risks the union driver
re-duplicating rows, so the queue cost far exceeds the fifteen lines
involved.

Rows are copied verbatim from each PR head and verified byte-identical,
so the original PRs can be closed as landed here rather than merged
individually.

* docs(ledger): record PR #1192 prlanded squash merge
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