Skip to content

Conversation

@tylerking999
Copy link

@tylerking999 tylerking999 commented Oct 16, 2025

Fixes #3267 - Duplicate player buttons appearing when navigating between videos

Changes Made

  • Added unique IDs to all player buttons (Loop, PiP, Screenshot, Key Scene, Copy Video ID)
  • Changed duplicate check from section-scoped to document-scoped
  • Each button now checks if it already exists globally before creation

Technical Details

The issue occurred because section.querySelector('.improvedtube-player-button') only searched within the section
element. When YouTube's SPA recreated the section during navigation, the old buttons persisted outside the new
section, causing duplicates.

Solution: Check for existing buttons at the document level using unique IDs instead of class-based section
queries.

Testing

  • Tested navigation between multiple videos
  • Verified buttons only appear once
  • Confirmed all button functionality works correctly

Test plan

  • Navigate between different videos
  • Verify only one instance of each button appears
  • Test all button functionality (Loop, PiP, Screenshot, Key Scene, Copy Video ID)

…ue IDs to all player buttons (Loop, PiP, Screenshot, Key Scene, Copy Video ID) -Changed duplicate check to search entire document instead of just section -Fixed issue code-charity#3267 where buttons duplicated when navigating between videos Each button now checks if it already exists globally before creation.
@rajanarahul93
Copy link
Contributor

rajanarahul93 commented Oct 16, 2025

Thanks for the fix! @tylerking999 Could you please attach a screenshot or short GIF showing the button behavior before and after your change? That’ll help confirm everything looks and works correctly.

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.

🐞Extra buttons Loop, pip, replayed scene, and screenshot duplicated with every viewed video

2 participants