fix: resolve stacked confirmation modals via global event delegation#1213
Open
siddhipatel0707-cpu wants to merge 1 commit into
Open
fix: resolve stacked confirmation modals via global event delegation#1213siddhipatel0707-cpu wants to merge 1 commit into
siddhipatel0707-cpu wants to merge 1 commit into
Conversation
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.
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:

After:

Checklist