Skip to content

fix(interact): reset clip-path before a viewEnter entrance starts - #335

Draft
nirnaor wants to merge 1 commit into
wix:masterfrom
nirnaor:fix/view-enter-initial-clip-path
Draft

nirnaor wants to merge 1 commit into
wix:masterfrom
nirnaor:fix/view-enter-initial-clip-path

Conversation

@nirnaor

@nirnaor nirnaor commented Oct 6, 2026

Copy link
Copy Markdown

Bug

For a viewEnter entrance in CSS mode (generate()), the initial-state rule [data-interact-key=…]:not([data-interact-enter]) resets transform/translate/scale/rotate so the IntersectionObserver measures the target's own box, but it does not reset clip-path.

Entrances whose backwards-filled first keyframe clips the element to nothing (TiltIn's motion-tiltInClip starts at polygon(0% 0%, 100% 0%, 100% 0%, 0% 0%); ShuttersIn, Reveal and others are similar) therefore hide their own trigger from the observer when the source and the target are the same element. The element never intersects, the entrance never plays, and the element stays visibility: hidden for good.

Repro

  1. Config with one interaction { key: 'el', trigger: 'viewEnter', effects: [{ key: 'el', namedEffect: { type: 'TiltIn', direction: 'left' }, duration: 1000, fill: 'backwards' }] }, inject generate(config) CSS and call Interact.create(config).
  2. Scroll the element into view. The three CSS animations stay paused at 0 and data-interact-enter is never set.
  3. Inject [data-interact-key]:not([data-interact-enter]) { clip-path: none !important } and the entrance plays on enter as expected.

Found while migrating Wix Classic sites to headless frontends that use @wix/interact: every TiltIn text on https://nirna3.wixsite.com/ecom-my-site-1 stayed invisible on the migrated site.

Fix

Add clip-path: none !important to DEFAULT_INITIAL, next to the transform resets. The element stays hidden by visibility: hidden until the entrance starts, and the rule stops matching once data-interact-enter is set, so the animation's clip-path applies from then on.

Tests

New case in packages/interact/test/css.spec.ts: a viewEnter entrance with a clip-path keyframe gets clip-path: none !important in its initial rule (fails without the fix).

cd packages/interact && npx vitest run
Test Files  11 passed (11)
     Tests  479 passed (479)

🤖 Generated with Claude Code

The initial-state rule that generate() writes for viewEnter entrances
(`:not([data-interact-enter])`) resets transforms so the IntersectionObserver
measures the target's own box. It did not reset clip-path. Entrances whose
backwards-filled first keyframe clips the element to nothing (TiltIn,
ShuttersIn, Reveal, ...) then hide their own trigger from the observer when
source and target are the same element: it never intersects, the entrance
never plays, and the element stays hidden.

Add `clip-path: none !important` to DEFAULT_INITIAL, next to the transform
resets. The element is still hidden by `visibility: hidden` until the
entrance starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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