Fix outro end time not auto-filling when category is selected via keyboard#2504
Fix outro end time not auto-filling when category is selected via keyboard#2504avi12 wants to merge 1 commit into
Conversation
Selecting the "Endcards/Credits" (outro) category auto-fills the end time to the video duration. But the category <select> has two options starting with "E": "Exclusive Access" (a full-video category) sorts before "Endcards/Credits", so keyboard type-ahead lands on it first. Passing through that full-video category zeroes the segment to [0, 0] and writes "0:00.000" into sponsorTimeEdits. When the next "e" reaches "Endcards/Credits", the auto-fill was skipped because it was guarded by sponsorTimeEdits[1] === null, which is no longer true, leaving the end time at zero. Selecting with the mouse skips Exclusive Access, which is why only the keyboard path was affected. Drop the stale sponsorTimeEdits[1] === null guard. The existing !segment[1] check already detects an unset end time and, unlike the edits state, is not polluted by passing through the full-video category. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a UI edge case in the segment editor where selecting the Endcards/Credits (outro) category via keyboard type-ahead could leave the segment end time incorrectly set to 0:00 instead of auto-filling to the video duration.
Changes:
- Removes a stale guard (
this.state.sponsorTimeEdits[1] === null) that could block outro end-time auto-fill after briefly selecting a full-video category via keyboard navigation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Please confirm you're human with a human written comment explaining what this does |
|
if I understand correctly, this is not the way to fix what you are going for, but it's impossible to understand your intent through the slop |
|
I mean I used Claude to figure out the code base, I don't fully know what the change entails, I just know that it works well |
|
what are you trying to do |
|
what is the problem |
|
currently in the select box if I select with the mouse "Endcards/Credits" it also fills in the end time to the video duration, which is the intended behavior |
Problem
When the Endcards/Credits (
outro) category is chosen for a segment, SponsorBlock auto-fills the segment's end time to the end of the video. This works when the category is selected with the mouse, but selecting it with the keyboard fills the end time with0:00instead.Steps to reproduce
etwice to reach Endcards/Credits (browser type-ahead).0:00.Root cause
The category
<select>has two options whose labels start with "E":exclusive_accessfullonlyoutroskip,muteKeyboard type-ahead lands on Exclusive Access first. Because it is a full-video category,
saveEditTimes()zeroes the segment to[0, 0]and writes"0:00.000"intosponsorTimeEdits. The secondethen reaches Endcards/Credits, but the outro auto-fill was gated behindthis.state.sponsorTimeEdits[1] === null— no longer true after the detour — so it was skipped and the end time stayed0. The mouse path never passes through Exclusive Access, which is why only the keyboard path was affected.Fix
Drop the stale
sponsorTimeEdits[1] === nullguard. The condition already checks!segment[1], which correctly detects an unset end time and, unlike the edits state, is not polluted by passing through the full-video category.Testing
npm run build:dev:chromebuilds cleanly; type-check passes.web-ext run -t chromiumand verified on a YouTube video: selecting Endcards/Credits via keyboard (e,e) now fills the end time with the video duration, matching the mouse behavior. Mouse selection and segments with an explicit end time are unchanged.🤖 Generated with Claude Code
A video to demonstrate the fix
2026-06-19.12-00-34.chrome.mp4