Repository navigation
fix(interact): emit timeline-scope for viewProgress effects outside their source - #346
Closed
ameerf-wix wants to merge 1 commit into
Closed
ameerf-wix wants to merge 1 commit into
ameerf-wix wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
generate()declares a viewProgress interaction'sview-timelineon its source, and the effect'sanimation-timelinereferences 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 anulltimeline.With
duration: autoand no timeline, the animation jumps straight to its after phase (finished, progress 1):fill: backwardseffects (in) do nothingfill: forwardseffects (out) freeze at their last keyframe; forshuttersScrollout 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-scopeon the common ancestor attaches the animations to the source'sViewTimelineand they scrub correctly.Fix
Collect the trigger timelines of viewProgress interactions that have at least one target other than the source, and emit:
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 astimelineScopeRule;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
🤖 Generated with Claude Code