fix: make 'no' the default button in delete/empty confirmation dialogs#437
Merged
Conversation
This is a critical safety improvement to prevent accidental data loss. Previously, the 'yes' button was selected by default in confirmation dialogs for delete and empty operations, making it extremely easy to accidentally destroy data by pressing 'e' followed by Enter. Changes: - Reorder confirmation dialog buttons from ['yes', 'no', 'don't ask me again'] to ['no', 'yes', 'don't ask me again'] making 'no' the default - Update button index mapping in confirmDeletionSelected() and confirmDeletionMarked() to handle the new button order - Add comprehensive tests to verify safer confirmation behavior - Replace deprecated strings.Title with golang.org/x/text/cases.Title - Maintain backward compatibility for all other functionality This addresses a known usability issue in the gdu community where users have reported significant data loss due to the dangerous default behavior. The fix aligns gdu with ncdu's safer approach of defaulting to 'no'.
Contributor
Author
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #437 +/- ##
==========================================
- Coverage 83.50% 83.49% -0.01%
==========================================
Files 46 46
Lines 4414 4412 -2
==========================================
- Hits 3686 3684 -2
Misses 656 656
Partials 72 72 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
- Add TestConfirmDeletionSelectedCase1 to cover the 'yes' button logic - Add TestConfirmDeletionMarkedCase1 to cover marked deletion 'yes' logic - Improves test coverage to address Codecov report issues - Ensures safety fix button reordering is properly tested
Contributor
Author
|
@dundee might be a good time to review and fix for all (really dangerous to have yes selected) |
dundee
approved these changes
Sep 22, 2025
Owner
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is a critical safety improvement to prevent accidental data loss. Previously, the 'yes' button was selected by default in confirmation dialogs for delete and empty operations, making it extremely easy to accidentally destroy data by pressing 'e' followed by Enter.
Problem
Users have reported significant data loss (up to 150GB) due to accidentally pressing 'e' followed by Enter, which would immediately confirm deletion with the dangerous 'yes' default. This creates an extremely high risk of accidental data loss with just two quick keypresses.
Changes
['yes', 'no', 'don't ask me again']to['no', 'yes', 'don't ask me again']making 'no' the defaultconfirmDeletionSelected()andconfirmDeletionMarked()to handle the new button orderstrings.Titlewithgolang.org/x/text/cases.TitleImpact
This addresses a known usability issue in the gdu community where users have reported significant data loss due to the dangerous default behavior. The fix aligns gdu with ncdu's safer approach of defaulting to 'no'.
Testing
Fixes the critical safety issue mentioned in community discussions where users have experienced data loss due to accidental confirmation of destructive actions.