Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: preserve keyboard scroll position inside help panels (#9688)
Adam Eivy47440461e520
diff --git a/client/src/components/ui/InfoTooltip.browser.test.js b/client/src/components/ui/InfoTooltip.browser.test.jsindex 6f618a0ffa..efa5a1b4ce 100644--- a/client/src/components/ui/InfoTooltip.browser.test.js+++ b/client/src/components/ui/InfoTooltip.browser.test.js@@ -119,7 +119,12 @@ describe.skipIf(!chrome)('help above glass cards and clipped scrollers', () => {await page.keyboard.press('Tab');expect(await panel.evaluate(el => el === document.activeElement)).toBe(true);await page.keyboard.press('End');- await page.waitForFunction(() => document.querySelector('[role="tooltip"]').scrollTop > 0);+ await page.waitForFunction(() => {+ const panel = document.querySelector('[role="tooltip"]');+ return panel.scrollHeight - panel.clientHeight - panel.scrollTop < 1;+ }, null, { timeout: 3000 });+ await page.evaluate(() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))));+ expect(await panel.evaluate(el => el.scrollHeight - el.clientHeight - el.scrollTop)).toBeLessThanOrEqual(1);await page.keyboard.press('Shift+Tab');expect(await trigger.evaluate(el => el === document.activeElement)).toBe(true);await page.keyboard.press('Tab');diff --git a/client/src/hooks/usePopoverPosition.js b/client/src/hooks/usePopoverPosition.jsindex 07da6e2dc6..ed61d6c299 100644--- a/client/src/hooks/usePopoverPosition.js+++ b/client/src/hooks/usePopoverPosition.js@@ -81,10 +81,11 @@ export default function usePopoverPosition({let effectivePosition = position;let maxHeight;if (constrainHeight) {- const aboveSpace = Math.max(0, triggerRect.top - gap - VIEWPORT_PADDING);- const belowSpace = Math.max(0, viewportHeight - triggerRect.bottom - gap - VIEWPORT_PADDING);+ const viewportSpace = Math.max(0, viewportHeight - VIEWPORT_PADDING * 2);+ const aboveSpace = Math.min(viewportSpace, Math.max(0, triggerRect.top - gap - VIEWPORT_PADDING));+ const belowSpace = Math.min(viewportSpace, Math.max(0, viewportHeight - triggerRect.bottom - gap - VIEWPORT_PADDING));// Measure natural height at the clamped width before choosing a side.- popover.style.maxHeight = `${Math.max(0, viewportHeight - VIEWPORT_PADDING * 2)}px`;+ popover.style.maxHeight = `${viewportSpace}px`;const height = popover.getBoundingClientRect().height;const preferredSpace = position === 'above' ? aboveSpace : belowSpace;if (height > preferredSpace) effectivePosition = aboveSpace > belowSpace ? 'above' : 'below';@@ -141,7 +142,10 @@ export default function usePopoverPosition({useEffect(() => {if (!open) return undefined;let rafId = null;- const onReflow = () => {+ const onReflow = (event) => {+ // Scrolling help does not move its anchor. Re-measuring would briefly+ // enlarge the live scroll container and clamp away its bottom scrollTop.+ if (constrainHeight && event.type === 'scroll' && popoverRef.current?.contains(event.target)) return;if (rafId !== null) return;rafId = requestAnimationFrame(() => {rafId = null;@@ -155,7 +159,7 @@ export default function usePopoverPosition({window.removeEventListener('resize', onReflow);window.removeEventListener('scroll', onReflow, true);};- }, [open, reposition]);+ }, [open, reposition, constrainHeight]);return { triggerRef, popoverRef, style, reposition };}