Fix scroll-driven opacity broken in Safari & Firefox#3587
Open
mattgperry wants to merge 1 commit intomainfrom
Open
Fix scroll-driven opacity broken in Safari & Firefox#3587mattgperry wants to merge 1 commit intomainfrom
mattgperry wants to merge 1 commit intomainfrom
Conversation
supportsScrollTimeline() only checked window.ScrollTimeline existence. Safari and Firefox expose the API but have bugs with non-transform properties (opacity stays intermediate in Safari, jumps to final value in Firefox). Replace the simple existence check with a runtime test that creates a scroll-driven opacity animation and verifies the computed value is correct. Also gate supportsViewTimeline() on the same check since it shares the underlying rendering engine. Fixes #3559 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryReplaced naive Key Changes:
The fix follows repository guidelines: includes proper E2E tests with test page in Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 58b5432 |
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.
Summary
window.ScrollTimeline !== undefinedexistence check with a runtime test that verifies scroll-driven opacity actually workssupportsViewTimeline()on the same check since ViewTimeline shares the same rendering engineProblem
Safari and Firefox expose
window.ScrollTimelinebut their implementations have bugs with non-transform properties likeopacity:scaleandrotatetransforms work correctly in both browsers. The issue is specifically with non-transform CSS properties driven by scroll timelines via WAAPI.Fix
The
supportsScrollTimeline()check now creates a tiny off-screen scrollable element, attaches a scroll-driven opacity animation, scrolls to the end, and verifies the computed opacity is correct (~1.0). This runs once (memoized) and automatically adapts as browsers fix their implementations.In browsers where the test fails (Safari, Firefox currently), the library falls back to the JS-based scroll tracking path which correctly drives all CSS properties.
Fixes #3559
🤖 Generated with Claude Code