Skip to content

feat: add confirmation dialog before clearing history and favorites#239

Open
jess2937 wants to merge 1 commit into
imDarshanGK:mainfrom
jess2937:main
Open

feat: add confirmation dialog before clearing history and favorites#239
jess2937 wants to merge 1 commit into
imDarshanGK:mainfrom
jess2937:main

Conversation

@jess2937
Copy link
Copy Markdown

Description

This PR adds a safety confirmation dialog to preventing accidental data loss when a user clicks the "Clear" buttons. Specifically, it introduces a window.confirm() popup when a user attempts to clear either their history or their saved favorites. If the user clicks "Cancel", the deletion process is safely aborted.

Related Issue

Fixes #167

Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation update
  • Test addition
  • Refactor

Checklist

  • I have read CONTRIBUTING.md
  • My branch is up to date with main
  • I have run pytest -v and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features (Level 2 and 3 issues)
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Screenshots (if frontend change)

image image

Confirmation Dialog View:

--

Test evidence

# Frontend changes verified manually in browser environment.
# Local execution of pytest encountered dependency resolution issues (ModuleNotFoundError for backend frameworks), which is unrelated to the frontend HTML confirmation UI implementation. 
# Action verified manually: Click event triggers browser confirmation box; 'Cancel' successfully returns/aborts deletion sequence; 'OK' execution clears application state items as expected.
<img width="1138" height="323" alt="image" src="https://github.com/user-attachments/assets/048701ac-e218-4d55-a73f-160fc8b30284" />

@jess2937 jess2937 requested a review from imDarshanGK as a code owner May 22, 2026 06:01
@jess2937
Copy link
Copy Markdown
Author

Hi @imDarshanGK ! 👋

I have completed the implementation for this feature.

Summary of changes:

  • Explicitly bound the confirmation logic to the global scope by updating the calls to window.confirm() within the clearHistoryBtn and clearFavsBtn click handlers inside frontend/index.html.
  • This ensures maximum reliability, aligns with web development best practices, and prevents any potential scope-resolution bugs in the frontend.

The PR template has been filled out. Ready for your review and feedback whenever you have time! Thank you.

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.

Add "Clear History" confirmation dialog before deleting history

1 participant