Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/globals.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -568,6 +568,7 @@ summary::-webkit-details-marker {
width: min(100%, clamp(19rem, 90vw, 52rem));
max-width: calc(100vw - 1rem - var(--safe-area-left) - var(--safe-area-right));
margin-inline: auto;
overflow: visible;
}

.universal-home-search-edge {
Expand Down
4 changes: 3 additions & 1 deletion src/components/ClinicalDashboard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -2443,7 +2443,7 @@
urlDocumentSearchBootstrappedRef.current = true;
void executeSearch(searchText, mode, scopeFilters);
// URL search intentionally runs once when the selected mode can execute.
}, [canRunSearch, answerThreadBootstrapped]);

Check warning on line 2446 in src/components/ClinicalDashboard.tsx

View workflow job for this annotation

GitHub Actions/ verify

React Hook useEffect has missing dependencies: 'executeSearch' and 'scopeFilters'. Either include them or remove the dependency array

useEffect(() => {
const updateHash = () => {
Expand DownExpand Up@@ -3180,7 +3180,7 @@
});
}

function stageAnswerFollowUpDraft(draft: string) {

Check warning on line 3183 in src/components/ClinicalDashboard.tsx

View workflow job for this annotation

GitHub Actions/ verify

'stageAnswerFollowUpDraft' is defined but never used
setQuery(draft);
focusComposerInput();
}
Expand DownExpand Up@@ -3882,7 +3882,9 @@
? // On tall phones the centred home leans slightly toward the
// bottom composer (matches the committed vertical-weighting
// guard); short phones skip the bias so content still fits.
"grid w-full place-items-center max-sm:[@media(min-height:800px)]:pt-[5vh]"
// Mobile uses top alignment so the integrated action menu is
// not clipped by the dead space below vertically centred homes.
"grid w-full place-items-center max-sm:place-content-start max-sm:justify-items-center max-sm:pt-[clamp(0.75rem,3vh,2rem)] max-sm:[@media(min-height:800px)]:pt-[5vh]"
: activeModeResultKind === "tools" ||
activeModeResultKind === "favourites" ||
activeModeResultKind === "differentials"
Expand Down
11 changes: 10 additions & 1 deletion src/components/clinical-dashboard/master-search-header.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -641,11 +641,20 @@ export function MasterSearchHeader({
}
}

const restoreActionMenuFocusRef = useRef(false);
const closeScope = useCallback((restoreFocus = false) => {
restoreActionMenuFocusRef.current = restoreFocus;
setScopeOpen(false);
if (restoreFocus) actionMenuTriggerRef.current?.focus();
}, []);

useEffect(() => {
if (scopeOpen || !restoreActionMenuFocusRef.current) return;
restoreActionMenuFocusRef.current = false;
window.requestAnimationFrame(() => {
actionMenuTriggerRef.current?.focus({ preventScroll: true });
});
}, [scopeOpen]);

const closeScopeSheet = useCallback(() => {
setScopeSheetOpen(false);
window.requestAnimationFrame(() => actionMenuTriggerRef.current?.focus());
Expand Down
2 changes: 1 addition & 1 deletion src/components/clinical-dashboard/mode-action-popup.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -370,7 +370,7 @@ export function ModeActionPopup({
const edgePadding = 12;
const availableAbove = Math.max(0, rect.top - viewportTop - edgePadding);
const availableBelow = Math.max(0, viewportBottom - rect.bottom - edgePadding);
const { minBodyHeight, minSurfaceHeight, headerHeight } = estimateIntegratedMenuHeights(items.length, integrated);
const { minSurfaceHeight, headerHeight } = estimateIntegratedMenuHeights(items.length, integrated);
const detachedUpOffset = 16;
const integratedDownOffset = integratedChipRow ? 58 : 14;
const detachedDownOffset = integrated ? integratedDownOffset : 14;
Expand Down
6 changes: 5 additions & 1 deletion src/components/use-dismissable-layer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,11 @@ export function useDismissableLayer({
if (event.key !== "Escape") return;
event.preventDefault();
onDismiss("escape");
window.requestAnimationFrame(() => restoreFocusRef?.current?.focus({ preventScroll: true }));
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
restoreFocusRef?.current?.focus({ preventScroll: true });
});
});
}

document.addEventListener("pointerdown", handlePointerDown, true);
Expand Down
7 changes: 4 additions & 3 deletions tests/ui-tools.spec.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -1004,7 +1004,7 @@ test.describe("Responsive layout guards", () => {
});
}

test("prescribing mode home bottom-anchors its content on phones but centres on tablet", async ({ page }) => {
test("prescribing mode home top-aligns on phones but centres on tablet", async ({ page }) => {
async function verticalWeighting(width: number) {
// Tall viewport exaggerates the free space so the anchor is unambiguous.
await page.setViewportSize({ width, height: 900 });
Expand All@@ -1019,10 +1019,11 @@ test.describe("Responsive layout guards", () => {
});
}

// Phone (< sm): content is pushed toward the bottom, so the gap above exceeds the gap below.
// Phone (< sm): content is top-aligned so integrated action menus are not
// clipped by dead space below vertically centred homes.
const phone = await verticalWeighting(375);
expect(phone).not.toBeNull();
expect(phone?.topGap ?? 0).toBeGreaterThan(phone?.bottomGap ?? 0);
expect(phone?.topGap ?? 0).toBeLessThan(phone?.bottomGap ?? 0);

// Tablet hero-composer homes include the portaled search shell in the measured
// block, so viewport gap balance is looser than phone bottom-anchoring.
Expand Down
Loading