Skip to content

Fix outro end time not auto-filling when category is selected via keyboard#2504

Open
avi12 wants to merge 1 commit into
ajayyy:masterfrom
avi12:fix/outro-endtime-keyboard-select
Open

Fix outro end time not auto-filling when category is selected via keyboard#2504
avi12 wants to merge 1 commit into
ajayyy:masterfrom
avi12:fix/outro-endtime-keyboard-select

Conversation

@avi12

@avi12 avi12 commented Jun 19, 2026

Copy link
Copy Markdown

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 with 0:00 instead.

Steps to reproduce

  1. On a YouTube video, start a new segment (set a start time) and open the segment edit menu.
  2. Focus the category dropdown and press e twice to reach Endcards/Credits (browser type-ahead).
  3. Expected: end time becomes the video duration. Actual: end time is 0:00.

Root cause

The category <select> has two options whose labels start with "E":

Order Label Category Action support
earlier Exclusive Access exclusive_access full only
later Endcards/Credits outro skip, mute

Keyboard 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" into sponsorTimeEdits. The second e then reaches Endcards/Credits, but the outro auto-fill was gated behind this.state.sponsorTimeEdits[1] === null — no longer true after the detour — so it was skipped and the end time stayed 0. The mouse path never passes through Exclusive Access, which is why only the keyboard path was affected.

Fix

Drop the stale sponsorTimeEdits[1] === null guard. 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.

-        } else if (this.state.sponsorTimeEdits[1] === null && category === "outro" && !sponsorTimesSubmitting[this.props.index].segment[1]) {
+        } else if (category === "outro" && !sponsorTimesSubmitting[this.props.index].segment[1]) {

Testing

  • npm run build:dev:chrome builds cleanly; type-check passes.
  • Loaded via web-ext run -t chromium and 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

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>
Copilot AI review requested due to automatic review settings June 19, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ajayyy

ajayyy commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Please confirm you're human with a human written comment explaining what this does

@ajayyy

ajayyy commented Jun 28, 2026

Copy link
Copy Markdown
Owner

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

@avi12

avi12 commented Jun 28, 2026

Copy link
Copy Markdown
Author

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

@ajayyy

ajayyy commented Jun 28, 2026

Copy link
Copy Markdown
Owner

what are you trying to do

@ajayyy

ajayyy commented Jun 28, 2026

Copy link
Copy Markdown
Owner

what is the problem

@avi12

avi12 commented Jun 28, 2026

Copy link
Copy Markdown
Author

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
however, if instead I select that option with the keyboard (press E), it fills in the end duration to "0:00:00" instead

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.

3 participants