Skip to content

Add ScrollTimeline/ViewTimeline API mocks #68

@trurl-master

Description

@trurl-master

Problem

Scroll-driven animations (parallax effects, scroll progress bars, reveal animations) cannot be tested in jsdom environments. Without ScrollTimeline and ViewTimeline APIs, developers cannot test whether:

  • Animations trigger at correct scroll positions
  • Animation progress matches scroll position correctly
  • Performance optimizations work (passive listeners, will-change)
  • CSS animation-timeline property functions properly
  • Modern scroll-based UI patterns behave as expected

Impact

  • Most developers don't test scroll animations at all
  • Manual scroll event calculations are complex and error-prone
  • Modern UI patterns using scroll-driven animations go untested
  • Performance regressions in scroll animations are not caught

Proposed Solution

Implement ScrollTimeline and ViewTimeline mocks that:

  • Integrate with existing Web Animations API implementation
  • Calculate timeline progress based on scroll position
  • Handle ViewTimeline intersection logic with elements
  • Support both JavaScript and CSS-based scroll animations
  • Manage timeline state across multiple animations

Implementation Challenges

  • Complex timeline calculation based on scroll position
  • ViewTimeline requires intersection logic with elements
  • Must integrate seamlessly with existing Web Animations API
  • Need to handle both JS and CSS-based scroll animations
  • Timeline state management across multiple animations

Current Implementation Status

  • ❌ jsdom: No Web Animations API support at all
  • ❌ happy-dom: Has basic Animation API but no timeline support
  • ❌ linkedom: No implementation
  • 🔧 Polyfill: flackr/scroll-timeline exists but is large

See future-features/scroll-timeline.md for detailed analysis.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions