code-charity / code-charity/youtube

💡Option to disable confirmation before closing on Youtube Music

Open
#4,249 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature request good first issue help wanted up-for-grabs
Dominant language
JavaScript
Stars
4.6k
Forks
996
Avg merge
2d 15h
Merged PRs (30d)
7

Description

PROBLEM:

  1. Go to e.g. https://music.youtube.com/watch?v=lYBUbBu4W08
  2. Start the music.
  3. Try to close the tab.

The tab doesn't close, instead "This page is asking you to confirm that you want to leave" confirmation box appears.

Note that this happens even with "Confirmation before closing" extension not installed. This is a "feature" of Youtube Music.

SOLUTION:

I would like to have an option to disable this behaviour. I.e. I want to be able to close the Youtube Music tab even with music playing.
This extension might be a good place for such a feature.

ALTERNATIVES:

I was able to disable this confirmation dialog using uBlock rule, which disables beforeunload JavaScript event on music.youtube.com.

music.youtube.com##+js(aeld, beforeunload)

RELEVANCE / SCOPE:

I think that confirmation dialog is annoying for any user who just wants to have the music playing in the background. There's this reddit thread about it: https://reddit.com/r/YoutubeMusic/comments/ju0fkz/disable_leave_page_confirmation/

"SIDE EFFECTS":

The extension already has "Confirmation before closing" option. But the default Youtube behaviour is to not prevent closing the tab on normal Youtube, and do prevent closing the tab on Youtube Music.

Because of that the extension should probably have a two separate options "Confirmation before closing on Youtube" and "Confirmation before closing on Youtube Music".
With two separate options there are no side effects, except a new option in a menu.

We could also not add another option in the menu, and instead make it so that "Confirmation before closing" option being disabled would also disable confirmation on Youtube Music. But that would create a side effect that it would disable close confirmation on Youtube Music for extension's existing users if they have "Confirmation before closing" disable (I think it's the default?).

CONTEXT:

This is very annoying for me, because this confirmation dialog prevent shutting down my computer. I.e., I click "Shut Down" button from computer's start menu, and the computer doesn't shut down until I click confirmation dialog on Youtube Music, or wait 2 minutes. At least that's the behaviour on KDE Linux.

//
Thank you!

SHORT Table (Summary)
Problem Youtube Music has close confirmation dialog
Solution add a new option to disable confirmation dialog
Alternatives this uBlock rule: music.youtube.com##+js(aeld, beforeunload)
Scope 30% of all Youtube Music users, 2% of all Youtube users
Side effects new option in menu
Context annoying, prevents shutting down computer

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing “Confirmation before closing” option and the handling of the browser’s beforeunload event. Check how music.youtube.com differs from regular YouTube, then verify that the requested option disables the confirmation for YouTube Music without changing existing behavior elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.