Skip to content

fix: prevent shared element handoff flashing - #2

Merged
milkevich merged 1 commit into
mainfrom
feat/shared-elements
Jul 25, 2026
Merged

fix: prevent shared element handoff flashing#2
milkevich merged 1 commit into
mainfrom
feat/shared-elements

Conversation

@milkevich

Copy link
Copy Markdown
Owner

Summary

The source shared element was hidden with visibility: hidden immediately after its clone was inserted, before mobile Safari had painted that clone. At the destination, the real target was also hidden with visibility, then revealed at the exact moment the 64 ms clone fade began. That creates a brief empty frame.

Fix

  • Mount the clone nearly transparent first.
  • Wait for cloned elements to load.
  • Wait two browser paint frames.
  • Swap source opacity to 0 and clone opacity to 1 together.
  • Use opacity instead of visibility, so elements remain paintable.
  • Wait for any incoming visual clone before movement begins.
  • Reveal the real target while the portal clone remains fully visible.
  • Wait two painted frames before fading the clone.
  • Wait another frame before cleanup removes the portal.
  • Preserve cancellation and cleanup behavior.

Validation

  • npm run check
  • npm run build
  • Tests cover new or changed behavior
  • Public documentation matches verified behavior
  • Public API and package contents were reviewed
  • Visual styling and layout are unchanged unless required by the change

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
routeveil Ready Ready Preview, Comment Jul 25, 2026 7:12am

@milkevich
milkevich merged commit bfa1e7b into main Jul 25, 2026
3 of 4 checks passed
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.

1 participant