Skip to content

Fix PWA search composer losing focus - #1373

Merged
BigSimmo merged 6 commits into
mainfrom
codex/search-composer-focus-pwa
Jul 29, 2026
Merged

Fix PWA search composer losing focus#1373
BigSimmo merged 6 commits into
mainfrom
codex/search-composer-focus-pwa

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep the shared phone/PWA search composer focused during passive keyboard and viewport scroll settling
  • release the focus pin only for an explicit wheel or touch gesture outside the composer
  • add DOM, static-contract, and browser regression coverage for browser-document and standalone-PWA scroll owners

Verification

  • Focused Vitest: 48/48 passed
  • TypeScript: passed
  • Branch review ledger guard: passed
  • verify:phone-chrome and verify:pr-local flight plans inspected
  • npm run verify:pr-local locally — not run because other repository dev servers prevented an isolated clean install; hosted CI on the exact head is the authoritative gate
  • npm run verify:ui locally — not run for the same install/process-isolation reason; the changed Playwright journey is included in hosted UI checks
  • npm run verify:release locally — provider/release gate delegated to the explicitly authorized protected-main workflow

Risk and rollout

  • Risk: Low and phone-scoped. Passive scroll notifications no longer blur the input; explicit outside scroll gestures still release focus so chrome can hide.
  • Rollback: Revert the two PR commits.
  • Provider or production effects: GitHub PR/CI and protected-main merge only; no data, Supabase, OpenAI, or deployment configuration changes.

Clinical Governance Preflight

Not applicable: this changes search-composer focus lifecycle only. It does not change retrieval, ranking, clinical content, source rendering, document access, privacy, or provider behavior.

RAG impact: no retrieval behaviour change — shared UI focus handling and regression tests only.

Notes

  • The local shared install was one dependency revision behind refreshed main, so its focused results are supporting evidence rather than installed-lock parity proof. Hosted CI uses the current lockfile.

Summary by CodeRabbit

  • Bug Fixes
    • Search composer focus no longer drops during passive scrolling in both browser and standalone PWA views.
    • Focus is released only when the user shows explicit scroll intent outside the composer, including keyboard scroll actions.
  • Tests
    • Added/expanded phone UI coverage for both scroll ownership modes (browser vs standalone PWA).
    • Updated DOM and contract tests to validate the new focus/hide behavior across wheel, touch, pointer, and keyboard gestures.
  • Documentation
    • Updated branch review ledger entries covering the fix and follow-up remediations.

@supabase

supabase Bot commented Jul 29, 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 29, 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

Run ID: a22f473f-e418-4736-a979-d33efa12c7c5

📥 Commits

Reviewing files that changed from the base of the PR and between f1bdeac and bbac22b.

📒 Files selected for processing (2)
  • docs/branch-review-ledger.md
  • tests/ui-phone-scroll.spec.ts
💤 Files with no reviewable changes (1)
  • tests/ui-phone-scroll.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/branch-review-ledger.md

📝 Walkthrough

Walkthrough

Passive scrolling no longer blurs the global search composer. Focus release now occurs only for explicit outside gestures or PageUp/PageDown keyboard navigation, with contract, DOM, browser, and PWA coverage.

Changes

Composer focus and scroll handling

Layer / File(s) Summary
Remove passive-scroll focus release
src/components/clinical-dashboard/global-search-shell.tsx
GlobalSearchShell scroll handlers report chrome scroll metrics without directly blurring the focused composer.
Wire explicit focus release
src/components/clinical-dashboard/use-hide-on-scroll.ts
Phone composer focus is released by outside wheel, touchmove, or pointerdown intent and by unmodified PageUp/PageDown keyboard navigation; passive scroll evaluation only reports scroll state.
Validate focus and scroll behavior
tests/header-scroll-hide-contract.test.ts, tests/use-hide-on-scroll.dom.test.tsx, tests/ui-phone-scroll.spec.ts, docs/branch-review-ledger.md
Tests cover listener contracts, focus persistence during passive scrolling, release after explicit intent, and browser-document versus standalone-PWA scroll owners; ledger entries record validation.

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

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant GlobalSearchShell
  participant useDocumentScrollHideReporter
  participant ComposerInput
  Browser->>GlobalSearchShell: emit scroll
  GlobalSearchShell->>useDocumentScrollHideReporter: report scroll metrics
  Browser->>useDocumentScrollHideReporter: emit outside gesture or PageDown
  useDocumentScrollHideReporter->>ComposerInput: release focus
Loading

Possibly related PRs

Suggested labels: codex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: preventing the PWA search composer from losing focus.
Description check ✅ Passed It follows the required template with Summary, Verification, Risk and rollout, Clinical Governance Preflight, and Notes, and the key fields are filled in.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a892ce1464

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/use-hide-on-scroll.dom.test.tsx
@BigSimmo

Copy link
Copy Markdown
Owner Author

@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a892ce1464

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/clinical-dashboard/use-hide-on-scroll.ts Outdated
@BigSimmo
BigSimmo merged commit 0adad0a into main Jul 29, 2026
20 checks passed
@BigSimmo
BigSimmo deleted the codex/search-composer-focus-pwa branch July 29, 2026 01:31
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.

1 participant