Skip to content

[BugFix] - pressing reset key doesn't stick on sites with per-site speed rules#1506

Open
kevinlabs wants to merge 1 commit intoigrigorik:masterfrom
kevinlabs:bugfix/reset-speed-overridden-by-site-rule
Open

[BugFix] - pressing reset key doesn't stick on sites with per-site speed rules#1506
kevinlabs wants to merge 1 commit intoigrigorik:masterfrom
kevinlabs:bugfix/reset-speed-overridden-by-site-rule

Conversation

@kevinlabs
Copy link
Copy Markdown

Summary

  • Reset (R key) to 1.0x gets immediately undone on sites with a custom
    speed rule (e.g. youtube.com set to 2.0x)
  • The next play/seeked media event snaps speed back to the site default
  • Added userSpeedOverride flag so the extension knows when a user has
    explicitly chosen a speed vs a fresh page load default

How to reproduce

  1. Go to Options → Site Rules → add youtube.com with speed 2.0
  2. Open any YouTube video — confirms it starts at 2.0x
  3. Press R to reset — speed drops to 1.0x
  4. Pause the video, then unpause (or click the scrubber to seek)
  5. Bug: speed snaps back to 2.0x instead of staying at 1.0x

Root cause

getTargetSpeed() treated lastSpeed === 1.0 as "no deliberate user
choice" and fell back to the site baseline. Pressing reset IS a deliberate
choice for 1.0, but the code couldn't distinguish it from a fresh page load.

Fix

  • setSpeed() now sets userSpeedOverride = true on user actions
  • getTargetSpeed() checks this flag first — if the user has acted,
    return their chosen speed regardless of value
  • Flag is session-only (not persisted), so fresh page loads still
    apply site rules correctly

Tests

  • Added: user reset to 1.0 on site with siteDefaultSpeed=2.0 → 1.0
  • Added: fresh load (no user action) with siteDefaultSpeed=2.0 → 2.0
  • All 358 existing tests pass

…ite speed rules

- Reset to 1.0x gets undone when pausing, scrubbing, or looping on sites with a custom speed rule (e.g. youtube.com at 2.0x)
- Root cause: getTargetSpeed() couldn't tell the difference between "user pressed reset" and "page just loaded" when lastSpeed is 1.0
- Added userSpeedOverride flag to track when user has explicitly chosen a speed, so site defaults don't overwrite it
- Flag is session-only, resets on page load so fresh loads still apply site rules correctly
- Added tests for both the fix and the fresh-load behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant