Skip to content
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

fix: Change requestNamedAnimationFrame to apply last change per frame instead of first #8799

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mister-ben
Copy link
Contributor

@mister-ben mister-ben commented Jul 14, 2024

Description

The current implementation of requestNamedAnimationFrame prevents multiple updates on a frame but by disregarding all but the first request per frame. This throttling behaviour is apparent when playing a very short video - if a timeupdate occurs just before the ended event, the progress bar position on the timeupdate is set at say 98% and 100% from the ended is discarded. Although #8633 removed the throttle from the ended handler itself, the throttle and non-throttled update can still both execute between frames.

Specific Changes proposed

Changes the implementation to apply only the last callback instead. If any exist they will be cancelled. There will still be only one update, but now it's the last.
Updates tests to reflect the changed behaviour.
Fixes #8782

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
    • Has no DOM changes which impact accessiblilty or trigger warnings (e.g. Chrome issues tab)
    • Has no changes to JSDoc which cause npm run docs:api to error
  • Reviewed by Two Core Contributors

@mister-ben mister-ben added the needs: discussion Needs a broader discussion label Jul 14, 2024
Copy link

codecov bot commented Jul 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.07%. Comparing base (0a836e1) to head (dfc7ee0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8799   +/-   ##
=======================================
  Coverage   83.07%   83.07%           
=======================================
  Files         120      120           
  Lines        8022     8022           
  Branches     1925     1925           
=======================================
  Hits         6664     6664           
  Misses       1358     1358           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mister-ben mister-ben changed the title fix: Change named to apply last change per frame instead of first fix: Change requestNamedAnimationFrame to apply last change per frame instead of first Jul 14, 2024
@mister-ben mister-ben marked this pull request as ready for review July 17, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: discussion Needs a broader discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Still facing issue with progress bar not completing 100%
1 participant