Skip to content

Fix Next/Previous Video shortcuts breaking out of playlists#3679

Merged
ImprovedTube merged 1 commit intocode-charity:masterfrom
LuciferDono:fix/next-video-shortcut-3678
Mar 7, 2026
Merged

Fix Next/Previous Video shortcuts breaking out of playlists#3679
ImprovedTube merged 1 commit intocode-charity:masterfrom
LuciferDono:fix/next-video-shortcut-3678

Conversation

@LuciferDono
Copy link
Copy Markdown
Contributor

Summary

  • Fixes 🐞Next Video shortcut broken ? #3678 — Next Video shortcut navigates outside playlist instead of to the next video within it
  • shortcutNextVideo and shortcutPrevVideo now detect playlist context (via list URL param) and click the player's built-in .ytp-next-button / .ytp-prev-button instead of calling player.nextVideo() / player.previousVideo(), which on recent YouTube versions no longer respect playlist context
  • Falls back to the original API calls when not in a playlist or if the buttons aren't found

Changes

js&css/web-accessible/www.youtube.com/shortcuts.js

  • shortcutNextVideo: check for playlist, click .ytp-next-button if present, else player.nextVideo()
  • shortcutPrevVideo: check for playlist, click .ytp-prev-button if present, else player.previousVideo()

Test plan

  • Open a YouTube playlist and press the Next Video shortcut — should advance to next video within the playlist
  • Press Previous Video shortcut — should go to previous video within the playlist
  • On a non-playlist video, Next/Previous shortcuts should work as before
  • Verify shortcuts still work when playlist panel is collapsed

shortcutNextVideo and shortcutPrevVideo used player.nextVideo() and
player.previousVideo() which on recent YouTube versions navigate
outside the current playlist instead of advancing within it.

When a playlist is active (URL contains 'list' param), click the
player's built-in .ytp-next-button / .ytp-prev-button instead,
which correctly stays within the playlist. Falls back to the API
calls when not in a playlist or if the buttons are not found.

Fixes code-charity#3678
@ImprovedTube ImprovedTube merged commit 220fd3a into code-charity:master Mar 7, 2026
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.

🐞Next Video shortcut broken ?

2 participants