Skip to content

Fix mobile lightbox freeze after closing from the history drawer - #36

Closed
CanyoufeeltheAGI with Copilot wants to merge 2 commits into
mainfrom
copilot/analyze-test-failures
Closed

CanyoufeeltheAGI with Copilot wants to merge 2 commits into
mainfrom
copilot/analyze-test-failures

Conversation

Copilot AI commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

On mobile, opening the lightbox from the history drawer could leave the page non-interactive after close. The underlying issue was overlapping drawer/dialog teardown, which could strand pointer-events, aria-hidden, or inert on body-level nodes.

  • Serialize mobile modal transitions

    • openLightbox now closes any mobile drawer first and defers the lightbox open until the drawer close animation has finished.
    • This prevents Vaul drawer teardown and Radix dialog setup from running concurrently.
  • Harden lightbox close cleanup

    • closeLightbox now performs delayed cleanup after dialog teardown instead of using requestAnimationFrame.
    • Cleanup resets stuck pointer-events on body and removes lingering aria-hidden / inert attributes when no other modal is open.
    • Pending delayed opens are cancelled if the lightbox is closed before the timer fires.
  • Keep callback behavior stable without render-time ref mutation

    • Drawer state used by openLightbox is still read through a ref to avoid callback churn, but the ref is now synchronized in useLayoutEffect instead of during render.
  • Add regression coverage

    • Tests cover:
      • delayed lightbox open when gallery/sidebar drawer is open
      • immediate open when no drawer is open
      • cancelling a pending open
      • delayed cleanup restoring stuck pointer-events
  • Align CI inputs

    • bun.lock is updated for the added @testing-library/dom dependency so frozen lockfile installs match the checked-in dependency graph.
if (hasOpenDrawer) {
  setShowLeftSidebar(false);
  setShowGallery(false);

  pendingLightboxTimerRef.current = setTimeout(() => {
    setLightboxImage(image);
    setIsFullscreen(true);
  }, 300);
} else {
  setLightboxImage(image);
  setIsFullscreen(true);
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Mar 7, 2026
@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
bloomstudio Ignored Ignored Preview Mar 7, 2026 0:14am

Co-authored-by: CanyoufeeltheAGI <255605710+CanyoufeeltheAGI@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test failures in history drawer lightbox Fix mobile lightbox freeze after closing from the history drawer Mar 7, 2026
@Simplereally
Simplereally deleted the copilot/analyze-test-failures branch March 11, 2026 09:21
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