Skip to content

Preserve focus=1 behavior on initial shell route loads - #204

Merged
BigSimmo merged 10 commits into
mainfrom
copilot/preserve-focus-initial-shell-loads
Jul 2, 2026
Merged

Preserve focus=1 behavior on initial shell route loads#204
BigSimmo merged 10 commits into
mainfrom
copilot/preserve-focus-initial-shell-loads

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Initial hard loads of shell mode-home deep links (e.g. /forms?focus=1, /services?focus=1) could drop keyboard focus after hydration/remount timing, so only later param changes reliably focused the composer.
  • Updated shell focus handling to make initial-load focus resilient and added targeted UI coverage for deep-link entry paths.
  • Focus reapply hardening
    • Split focus handling into a dedicated effect keyed by route/search params.
    • Re-applies focus on first frame and one short delayed retry, while avoiding focus-steal if another interactive element is already active.
  • Regression coverage
    • Added an e2e assertion that /services?focus=1 and /forms?focus=1 land with global-search-input focused.
const shouldApplyFocus = (activeElement: Element | null) =>
  !activeElement || activeElement === document.body || activeElement === document.documentElement;

const frame = window.requestAnimationFrame(focusInput);
const timeout = window.setTimeout(focusInput, focusHydrationRetryDelayMs);

Verification

  • npm run verify:cheap
  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
  • npm run verify:release before release or handoff confidence claims
  • npm run format:check
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed
  • npm run check:deployment-readiness when deployment startup, hosting, or rollout behavior changed

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • 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

  • Scope is limited to shell composer focus behavior and its UI regression coverage; no clinical, privacy, or deployment-path logic changes.

@BigSimmo
BigSimmo marked this pull request as ready for review July 2, 2026 17:24
@BigSimmo
BigSimmo enabled auto-merge July 2, 2026 17:24
auto-merge was automatically disabled July 2, 2026 17:26

Head branch was pushed to by a user without write access

Copilot AI changed the title [WIP] Fix issue with focus=1 on initial shell loads Preserve focus=1 behavior on initial shell route loads Jul 2, 2026
Copilot AI requested a review from BigSimmo July 2, 2026 17:28
@BigSimmo
BigSimmo enabled auto-merge July 2, 2026 17:33
@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

auto-merge was automatically disabled July 2, 2026 18:21

Head branch was pushed to by a user without write access

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved by merging origin/main into this branch and fixing the conflict in src/components/clinical-dashboard/global-mockup-search-shell.tsx in commit b0cd9e2.

@BigSimmo
BigSimmo enabled auto-merge July 2, 2026 18:44
@BigSimmo
BigSimmo merged commit 19cbbc5 into main Jul 2, 2026
4 checks passed
@BigSimmo
BigSimmo deleted the copilot/preserve-focus-initial-shell-loads branch July 5, 2026 11:44
BigSimmo added a commit that referenced this pull request Aug 1, 2026
Resolve docs/error-tracking.md by keeping both the ingestion-worker
section and main's Agent Monitoring wizard mapping. Resolve
docs/outstanding-issues.md by keeping main's open rows, removing the
blank line that orphaned #183/#186 outside the open table, renumbering
this PR's npm lockfile issue to #204, and bumping issues:next-id to 205.

Co-authored-by: Cursor <cursoragent@cursor.com>
BigSimmo added a commit that referenced this pull request Aug 1, 2026
CodeRabbit correctly noted the queue claims to list every open ledger
row but omitted the npm lockfile/CI issue added during the main merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

**<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve focus=1 on initial shell loads**

2 participants