Add "warning/confirmation" dialog when closing a window w/ multiple tabs
See original GitHub issueDescription
Several users have requested the option to confirm whether or not they want to close a window when multiple tabs are open in it. This functionality would be similar to what is already implemented in other browsers like Firefox and IE:

This functionality would prevent users from inadvertently closing a browser window. Also note that this functionality exists when attempting to Quit the application process and even has an option to opt out of the Press to hold function:

Designs
Add the preference to warn when closing multiple tabs to the Help tips section in brave://settings. This is off by default.

Move Show warning before quitting with ⌘Q out of the Appearance section and to the Help Tips section too.
When toggled on, show a warning dialog when the user when closing multiple tabs.
Assets
Figma: https://www.figma.com/file/pVwKlNQJU9wTVOa9tImKpo/?node-id=318%3A9788
Miscellaneous Information:
Several users responding to this feature request – will add additional request threads as I find them: https://community.brave.com/t/five-years-and-no-progress-warn-before-closing-multiple-tabs/86525/7
Issue Analytics
- State:
- Created 3 years ago
- Reactions:52
- Comments:59 (10 by maintainers)

Top Related StackOverflow Question
@9codes it might be a bit late, but you can use a shortcut Ctrl + Shift + T (on macOS: Cmd + Shift + T) to restore your last closed tab / window. You can use this multiple times and you should be able to restore it. This works in Chromium and other browsers too
Verification
PASSEDusingFiled #https://github.com/brave/brave-browser/issues/23090
OFFby defaultCase 2: Basic Test- Show `Close all tabs` warning dialog upon closing multiple tabs, when the pref is `enabled` - PASSED
Continue where you left off in brave://settings/getStartedClose all tabsdialog is not launched since pref isOFFby defaultWarn me before closing window with multiple tabsin Help tips section of brave://settingsClose all tabsdialog displayed with correct textCancelbuttonClose allbutton in the Warning dialogCase 3: Do not show `Close all tabs` warning dialog when the pref is `disabled` again OR `Don’t ask me again` check box is checked - PASSED
Continue where you left off in brave://settings/getStartedWarn me before closing window with multiple tabspref in Help tips section of brave://settingsClose all tabsdialog not displayedDon’t ask me againClose allbuttonWarn me before closing window with multiple tabspref is disabledCase 4: Test with `onbeforeunload` handler -PASSED
Click here to go to w3schools.comand checkbeforeunloaddialog is launched. Then, dismiss it.Close alland checkbeforeunloaddialog is launchedbeforeunloaddialogClose all tabsis shown againbeforeunloaddialog and check window is closedCase 5: Test with download in-progress handler -PASSED
Fresh Install
Case 6: Test with onbeforeunload and download in-progress handler - PASSED
(Note: On macOS, download warning dialog is not shown on normal profile. Private window will have same behavior on macOS with other platform's normal window)Fresh Install
beforeunloaddialog is launched after selectingClose AlldialogCase 7:Test with reboot/restart - PASSED</summary- Launch Browser and set option is enabled
- Create window and create more than one NTP tabs
- Load
- Repeat step 1,2 and load
- Verified
Ex1
Ex2
Ex3



brave://restartand check window closing dialog is not launchedbrave://quitand check window closing dialog is not launchedClose allwarning dialog is not launched for bothrestartandquitCase 8: Test with update - PASSED
Close allwarning dialog is not launched upon updateCase 9: Test with profile deletion -PASSED
Close allwarning dialog is not launchedCase 10: Windows/Linux specific test - PASSED
Close allwarning dialog is launched for both windowsAdditional scenarios
Close all tabswarning dialog works as expected withOpen the New Tab Pageselection in brave://settings/getStartedClose all tabswarning dialog works as expected withOpen a specific page or set of pagesselection in brave://settings/getStartedClose all tabswarning dialog works as expected with TOR windowClose all tabswarning dialog works as expected with Private windowTest Case II Upgrade:
Upgrade Test - PASSED</summary- Install 1.39.x
- Create window with than one tab
- Help tips section in brave://settings do not have
- Load brave://settings/help and wait for updates to complete
- Click to Relaunch the browser
- Verified
Ex1
Ex2
Ex3
Ex4




Warn me before closing window with multiple tabsprefWarn me before closing window with multiple tabspref is available and set toOFFas a default