Skip to content

Scope clearToasts to the dialog being closed#3414

Open
Salvialf wants to merge 1 commit into
developfrom
fix/toast-clear-scope
Open

Scope clearToasts to the dialog being closed#3414
Salvialf wants to merge 1 commit into
developfrom
fix/toast-clear-scope

Conversation

@Salvialf

@Salvialf Salvialf commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Problem

jeeDialog's close() unconditionally calls clearToasts(), which removes every toast currently displayed on the page, not just the ones related to the dialog being closed. Since there is a single shared toast container reused across the whole page, any toast shown right before closing a dialog (a common pattern: perform an action, then close the dialog) gets wiped out immediately.

Plugins have been working around this by manually closing the dialog before showing the success toast instead of the more natural order (see calendar/event.edit.js or ocpp/authorisations.js as examples).

Fix

clearToasts() now accepts an optional scope element. When provided, it only removes the toast container if it is currently a descendant of that scope, leaving toasts attached elsewhere (typically document.body) untouched. The main dialog's close() now passes itself as the scope, so it only cleans up toasts explicitly attached to it via attachTo.

All other existing call sites (page navigation, notification center, legacy jQuery shim) keep clearing every toast since they call clearToasts() without a scope, so their behavior is unchanged.

@Salvialf Salvialf added the changelog-fix Use to generate release notes / changelog To be apply on PR label Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-fix Use to generate release notes / changelog To be apply on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants