Repository navigation
One header behaviour: tabs come back on scroll up, Back in the top bar, Psychiatry uses the bottom search box #3518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e1ddf3d
Header standard: tabs return on scroll up everywhere, one Back in the…
claude cc96356
Header standard: record the rule in the chrome docs and move tests to…
claude 730fa9d
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude 686e9e6
Speed up the header's return on the two longest Clinical lists
claude f460c38
Clear the pinned tab rail when jumping to a section on phones
claude 184e8a7
Keep the top bar on screen while its Back control has focus
claude 5e4b9ab
Point the Therapy sheet accessibility test at the builder picker
claude e3825b1
Move the top bar's Back focus tracking into its own hook
claude c27ffd8
Name the Therapy sheet builder picker for its accessibility test
claude bcc0ec6
Hide Psychiatry's box offline, drop its tablet dock reserve, excuse W…
claude aaa7b70
Keep Work pages under the size budget, fix Back tests and Psychiatry …
claude 2f7b76a
Header follow-ups: keep record actions reachable and section jumps cl…
claude 53dd39a
Merge remote-tracking branch 'origin/main' into header-followups
claude 17b1406
Merge branch 'main' into claude/project-thread-pptby2
BigSimmo 928d38e
Merge remote-tracking branch 'origin/claude/project-thread-pptby2' in…
claude 7ad966c
Count the top bar once on section jumps under a pinned tab row
claude 4efd74d
Merge main into the Header change, keeping the Ask box on Psychiatry
claude b5f6c2d
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude e26be88
Psychiatry: show the offline note on Saved too, merge main
claude 2df4d43
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude 90f6a4e
Docs: record the owner's keep-as-built decision for pinned record hea…
claude 2eb4c7f
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude d20f4a1
docs: drop removed showBackLabel guidance; Back lives in the top bar
claude 6bab4bb
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude 9fbdad4
docs: stop counting the breadcrumb row's optional props
claude 457c3f4
Merge branch 'main' into claude/project-thread-pptby2
BigSimmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/components/clinical-dashboard/use-portal-slot-focus.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| "use client"; | ||
|
|
||
| import { useEffect, type RefObject } from "react"; | ||
|
|
||
| /** | ||
| * Pages portal their Back control into the top bar's leading slot. React routes | ||
| * focus events from a portal through the page's tree, so the header's own focus | ||
| * capture never sees them. Listening on the real DOM slot lets a focused Back | ||
| * keep the bar on screen like any other header control. | ||
| */ | ||
| export function usePortalSlotFocus( | ||
| slotRef: RefObject<HTMLElement | null>, | ||
| enabled: boolean, | ||
| setFocused: (focused: boolean) => void, | ||
| ) { | ||
| useEffect(() => { | ||
| const slot = slotRef.current; | ||
| if (!slot || !enabled) return undefined; | ||
| const slotHoldsFocus = () => document.activeElement instanceof Node && slot.contains(document.activeElement); | ||
| const handleFocusIn = () => setFocused(true); | ||
| // Back may already hold focus when this starts (focus restored before the | ||
| // header enabled hiding); no focusin would follow, so read it now. | ||
| if (slotHoldsFocus()) queueMicrotask(() => setFocused(true)); | ||
| const handleFocusOut = (event: FocusEvent) => { | ||
| const nextTarget = event.relatedTarget; | ||
| if (!(nextTarget instanceof Node) || !slot.contains(nextTarget)) setFocused(false); | ||
| }; | ||
| // A focused Back that navigates away unmounts without a focusout. | ||
| const observer = new MutationObserver(() => { | ||
| if (!slotHoldsFocus()) setFocused(false); | ||
| }); | ||
| observer.observe(slot, { childList: true, subtree: true }); | ||
| slot.addEventListener("focusin", handleFocusIn); | ||
| slot.addEventListener("focusout", handleFocusOut); | ||
| return () => { | ||
| slot.removeEventListener("focusin", handleFocusIn); | ||
| slot.removeEventListener("focusout", handleFocusOut); | ||
| observer.disconnect(); | ||
| }; | ||
| }, [slotRef, enabled, setFocused]); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.