Skip to content

fix(site): auto-scroll detail panel into view on mobile when a measure is selected - #69

Merged
DevSecNinja merged 2 commits into
mainfrom
copilot/fix-mobile-auto-scroll
Jun 18, 2026
Merged

fix(site): auto-scroll detail panel into view on mobile when a measure is selected#69
DevSecNinja merged 2 commits into
mainfrom
copilot/fix-mobile-auto-scroll

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

On mobile (≤ 1080 px, single-column layout), the MeasureDetailPanel renders below the measure grid. Selecting a measure updates the panel content but leaves it off-screen, requiring a manual scroll.

Changes

  • MeasureDetailPanel — adds a useRef/useEffect that calls scrollIntoView whenever measure changes, gated on window.innerWidth <= 1080 (matching the CSS breakpoint where the layout collapses to one column). On desktop the panel is already visible in its sticky side-column, so the guard is a no-op there.
useEffect(() => {
  if (
    measure &&
    panelRef.current &&
    typeof panelRef.current.scrollIntoView === 'function' &&
    window.innerWidth <= MOBILE_BREAKPOINT
  ) {
    panelRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
  }
}, [measure]);

The typeof scrollIntoView === 'function' guard prevents a crash in the jsdom test environment, which does not implement this DOM API.

Copilot AI changed the title [WIP] Fix mobile auto scroll for Measure details fix(site): auto-scroll detail panel into view on mobile when a measure is selected Jun 18, 2026
Copilot AI requested a review from DevSecNinja June 18, 2026 15:47
@DevSecNinja
DevSecNinja marked this pull request as ready for review June 18, 2026 15:49
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Preview deployed: https://edc40cd5.grip-visualizer.pages.dev

Updated: Thu, 18 Jun 2026 15:51:16 GMT

@DevSecNinja
DevSecNinja merged commit bd07a36 into main Jun 18, 2026
22 checks passed
@DevSecNinja
DevSecNinja deleted the copilot/fix-mobile-auto-scroll branch June 18, 2026 16:04
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.

2 participants