-
Notifications
You must be signed in to change notification settings - Fork 108
Handle exceptions when auto-aligning start time #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle exceptions when auto-aligning start time #193
Conversation
What are some examples of these values?
Perfect! |
Currently we don’t support relative units such as Edit: I realized I didn't add any examples, so I'm adding one now. element.animate( { width: ['0px', '200px' ] }, {
timeline: viewTimeline,
rangeStart: '5em',
rangeEnd: 'calc(1px + 10vh),
fill: 'both'
});Both rangeStart and rangeEnd are |
88a2f50 to
5fe7d6d
Compare
Maybe we should add a |
Maybe 🤔 I considered this, but this procedure can be run quite often and it would spam the logs. Maybe if we add a flag per timeline and only issue the warning once? 🤔 |
Hmm, good call. Spamming the console with message is infeasible indeed.
Another way to bypass this could be to error out entirely for that specific Scroll-Timeline: instead of adding an animation with the default (wrong) timeline offset, remove the scroll-animation altogether. |
Hmmm.. I think we can leave the timeline active, as the range is set and calculated for the animation and not the timeline. The timeline might be used for multiple animations, and we should leave the others playing. I think we can either
I'm not sure which would be the best, but I'm slightly leaning towards the latter. try {
startOffset = CSS.percent(fractionalStartDelay(details) * 100);
} catch (e) {
// TODO: Validate supported values for range start, to avoid exceptions when resolving the values.
// Range start is invalid, falling back to default value
startOffset = CSS.percent(0);
details.animationRange.start = 'normal';
console.warn("Exception when calculating start offset", e);
}It would be better to validate the range when it's set. It might be hard to detect whether a CSSNumericValue contains unsupported units, but we might be able to leverage CSSNumericValue toSum() to check which units are used. This is something we should solve in a separate PR though. |
5fe7d6d to
86511de
Compare
|
@bramus I implemented the change I suggested in the comment above. |
86511de to
2ccfc00
Compare
2ccfc00 to
e57d9d5
Compare
It is currently possible to set values for the attachment range that are valid length-percentage values, but that are not supported in the polyfill yet.
This will cause en error to be thrown when we try to auto-align the start time, preventing tickAnimation from completing as expected.
We should probably add a stricter validation when setting the range, but for now I think we should catch the exception and fall back to using the full animation range.
Merging this PR should prevent the timeouts that occurred in the WPT subtests in #153