Skip to content

fix: resolve stacked confirmation modals via global event delegation#1213

Open
siddhipatel0707-cpu wants to merge 1 commit into
Charushi06:mainfrom
siddhipatel0707-cpu:fix/stacked-delete-modals
Open

fix: resolve stacked confirmation modals via global event delegation#1213
siddhipatel0707-cpu wants to merge 1 commit into
Charushi06:mainfrom
siddhipatel0707-cpu:fix/stacked-delete-modals

Conversation

@siddhipatel0707-cpu

Copy link
Copy Markdown

Related Issue

Closes #1212

Summary

This PR resolves a critical UI bug where multiple duplicate "Confirm Action" modals stack vertically at the bottom of the page when attempting to delete a task. This was caused by an event listener accumulation pattern across different dashboard views.

Changes Made

-Refactored Event Handling: Removed redundant, individual event listeners being bound to .delete-task-btn inside the dynamic renderTasks() loop.
-Implemented Global Event Delegation: Added a view-independent, single event listener on the static parent container #tasks-section inside DOMContentLoaded.
-Added Missing Styles in Stylesheet (css/index.css): Appended essential modern layout rules for .toast-container, .toast-notification, .custom-confirm-backdrop, and .custom-confirm-modal.
-Configured position overlays (position: fixed, inset: 0) to transition the toast system into floating indicators in the top-right corner and transform the confirmation system into a centered, dimmed backdrop modal rather than rendering as plain unstyled inline blocks appended at the bottom of the viewport below the footer.

Testing

-Local Functional Testing: Validated behavior locally on localhost:3000 under Google Chrome , Microsoft Edge
-Verified that switching between the main task dashboard and the Calendar view no longer causes event accumulation. Clicking "Delete" now triggers exactly one modal, and clicking "Confirm" or "Cancel" cleanly unmounts the element from the DOM.

Screenshots

Before:
Screenshot 2026-07-03 120114

After:
image

Checklist

  • Code follows project style
  • Tested locally
  • No unrelated changes included
  • Documentation updated (if applicable)

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.

bug: Persistent and Stacking "Confirm Action" Modals

1 participant