fixed z-index for safari

This commit is contained in:
Dmitri 2026-04-16 10:11:54 +04:00
parent b40dfe54b5
commit 7ea063390d

View File

@ -351,19 +351,13 @@ export default function RuntimePresentation({
}, [pendingTransitionComplete, isBackgroundReady]);
// Safari Black Flash Prevention (video transitions only):
// Update lastKnownBgUrl when a background is successfully displayed.
// This creates a "snapshot" that persists through video transitions.
// Update lastKnownBgUrl whenever we have a valid background image.
// This ensures snapshot is always ready before transitions start.
useEffect(() => {
if (isBackgroundReady && pageSwitch.isNewBgReady) {
if (pageSwitch.currentBgImageUrl) {
setLastKnownBgUrl(pageSwitch.currentBgImageUrl);
}
if (pageSwitch.currentBgImageUrl) {
setLastKnownBgUrl(pageSwitch.currentBgImageUrl);
}
}, [
isBackgroundReady,
pageSwitch.isNewBgReady,
pageSwitch.currentBgImageUrl,
]);
}, [pageSwitch.currentBgImageUrl]);
const navigateToPage = useCallback(
async (
@ -577,14 +571,13 @@ export default function RuntimePresentation({
{/* Safari Black Flash Prevention (video transitions only):
Persistent snapshot layer shown ONLY during video transitions.
NOT shown during crossfade navigation (would interfere with animation).
z-[-1] keeps it behind all dynamic content layers. */}
z-[1] keeps it behind backgrounds (z-5) but above the black container. */}
{lastKnownBgUrl &&
isSafari() &&
(transitionPreview || pendingTransitionComplete) && (
<div
className='absolute inset-0 pointer-events-none'
className='absolute inset-0 z-[1] pointer-events-none'
style={{
zIndex: -1,
backgroundImage: `url("${lastKnownBgUrl}")`,
backgroundSize: 'contain',
backgroundPosition: 'center',