:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(homepage): stop orange ring flashing on hovered grid rows (#106012)
posthog[bot]95b35d541850
diff --git a/frontend/src/scenes/project-homepage/ai-first/HomepageInput.tsx b/frontend/src/scenes/project-homepage/ai-first/HomepageInput.tsxindex 29f6e8600f9f..de1eb21a1868 100644--- a/frontend/src/scenes/project-homepage/ai-first/HomepageInput.tsx+++ b/frontend/src/scenes/project-homepage/ai-first/HomepageInput.tsx@@ -423,6 +423,11 @@ function IdleGrid(): JSX.Element {// [col, row] position of the highlighted item, null = nothing highlighted.// Column 0 is the suggestions list, column 1 the whole rail (dashboards then recents).const [highlight, setHighlight] = useState<[number, number] | null>(null)+ // Hover also sets the highlight, so arrow keys continue from the hovered row. Only a keyboard+ // highlight renders, because the global `[data-highlighted]:not(:hover)` outline in base.scss+ // flashes on the old row when React commits the hover state after the browser updates :hover.+ const [highlightFromKeyboard, setHighlightFromKeyboard] = useState(false)+ const visibleHighlight = highlightFromKeyboard ? highlight : nullconst gridRef = useRef<HTMLDivElement>(null)const [skeletonCounts, setSkeletonCounts] = useState(getStoredSkeletonCounts)@@ -472,6 +477,7 @@ function IdleGrid(): JSX.Element {if (e.target !== e.currentTarget) {return}+ setHighlightFromKeyboard(true)// Find the next non-empty column in a given directionconst findNonEmptyCol = (from: number, direction: 1 | -1): number | null => {@@ -554,20 +560,25 @@ function IdleGrid(): JSX.Element {// Scroll highlighted item into viewuseEffect(() => {- if (!highlight || !gridRef.current) {+ if (!visibleHighlight || !gridRef.current) {return}const el = gridRef.current.querySelector('[data-highlighted="true"]')if (el) {el.scrollIntoView({ block: 'nearest' })}- }, [highlight])+ }, [visibleHighlight])const railHighlightOffset: Record<'dashboard' | 'recent', number> = {dashboard: 0,recent: railItemsByKind.dashboard.length,}+ const highlightFromPointer = (position: [number, number] | null): void => {+ setHighlight(position)+ setHighlightFromKeyboard(false)+ }+// Collapse-on-typing is handled by the shared wrapper in HomepageInput, so this renders the// grid content directly (no self-collapse), keeping the badges and grid in one animated box.return (@@ -586,6 +597,7 @@ function IdleGrid(): JSX.Element {const firstCol = columns.findIndex((c) => c.items.length > 0)if (firstCol !== -1) {setHighlight([firstCol, 0])+ setHighlightFromKeyboard(true)}}}}@@ -618,8 +630,8 @@ function IdleGrid(): JSX.Element {<SuggestionRowkey={item.id}item={item}- highlighted={highlight?.[0] === 0 && highlight?.[1] === rowIndex}- onHighlight={(over) => setHighlight(over ? [0, rowIndex] : null)}+ highlighted={visibleHighlight?.[0] === 0 && visibleHighlight?.[1] === rowIndex}+ onHighlight={(over) => highlightFromPointer(over ? [0, rowIndex] : null)}/>)))}@@ -649,8 +661,10 @@ function IdleGrid(): JSX.Element {<GridRowkey={item.id}item={item}- highlighted={highlight?.[0] === 1 && highlight?.[1] === offset + index}- onHighlight={(over) => setHighlight(over ? [1, offset + index] : null)}+ highlighted={+ visibleHighlight?.[0] === 1 && visibleHighlight?.[1] === offset + index+ }+ onHighlight={(over) => highlightFromPointer(over ? [1, offset + index] : null)}/>)))}