Skip to content

fix(interact): emit timeline-scope for viewProgress effects outside their source - #346

Closed
ameerf-wix wants to merge 1 commit into
masterfrom
fix/css-timeline-scope
Closed

ameerf-wix wants to merge 1 commit into
masterfrom
fix/css-timeline-scope

Conversation

@ameerf-wix

@ameerf-wix ameerf-wix commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

generate() declares a viewProgress interaction's view-timeline on its source, and the effect's animation-timeline references it by name. A named view-timeline only resolves for the declaring element and its descendants, so when the effect targets a different element (e.g. a sibling), the CSS animation gets a null timeline.

With duration: auto and no timeline, the animation jumps straight to its after phase (finished, progress 1):

  • fill: backwards effects (in) do nothing
  • fill: forwards effects (out) freeze at their last keyframe; for shuttersScroll out that's a fully-clipped polygon, so the element never appears (reported in Chrome and Safari, debugged in Chrome)

Verified on an affected site: adding timeline-scope on the common ancestor attaches the animations to the source's ViewTimeline and they scrub correctly.

Fix

Collect the trigger timelines of viewProgress interactions that have at least one target other than the source, and emit:

:root {
  timeline-scope: --trigger-1, --trigger-2;
}

Timelines that only animate their source aren't scoped. An element that declares the name itself still resolves to its own timeline before reaching the scope.

_generate() returns it as timelineScopeRule; generate() appends it after the lists rule.

Note

A scoped name resolves to an inactive timeline if more than one element declares it. That only happens when a cross-element source key matches several elements, which is ambiguous anyway.

Tests

  • Scopes the timelines of cross-element effects and sequences, but not the ones that only animate their source
  • Emits nothing when every timeline animates only its source

🤖 Generated with Claude Code

…heir source

A source's view-timeline only resolves for itself and its descendants, so an effect
targeting another element got a null timeline and its forwards fill froze it at its
end keyframe (e.g. shuttersScroll-out left the element fully clipped).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ameerf-wix ameerf-wix closed this Oct 21, 2026
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