Skip to content

Replace browser native dialogs with Bootstrap modal system - #130

Merged
itshypax merged 4 commits into
updatefrom
copilot/replace-confirmation-prompts
Nov 4, 2025
Merged

Replace browser native dialogs with Bootstrap modal system#130
itshypax merged 4 commits into
updatefrom
copilot/replace-confirmation-prompts

Conversation

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Native confirm() and alert() block JavaScript execution and provide poor UX. This PR replaces all 53 instances across the codebase with a Bootstrap-based modal system.

Changes

New dialog system (assets/js/dialogs.js):

  • showConfirm() - Promise-based confirmations with danger styling for destructive actions
  • showAlert() - Typed alerts (success/error/warning/info) with contextual icons
  • showPrompt() - Input dialogs with keyboard support

Replaced across 28 files:

  • 21 confirm()showConfirm()
  • 32 alert()showAlert()
  • Coverage: notifications, user management, eNotf protocols, settings, documents, vehicles

Key improvements:

  • HTML escaping prevents XSS
  • Promise resolution guards prevent race conditions
  • Non-blocking execution
  • Contextual titles and danger styling for delete operations

Example

Before:

if (confirm('Benachrichtigung wirklich löschen?')) {
    document.getElementById('delete-form').submit();
}

After:

showConfirm('Benachrichtigung wirklich löschen?', {
    danger: true,
    confirmText: 'Löschen',
    title: 'Benachrichtigung löschen'
}).then(result => {
    if (result) document.getElementById('delete-form').submit();
});

For inline handlers:

<form onsubmit="event.preventDefault(); showConfirm('Delete?', {danger: true}).then(r => { if(r) this.submit(); });">
Original prompt

This section details on the original issue you should resolve

<issue_title>Standard-Browser Call-To-Action-Felder tauschen</issue_title>
<issue_description>So sachen wie return confirm('Benachrichtigung wirklich löschen?') durch ein eigenes System oder Modals oder vgl. austauschen.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 4, 2025 03:00
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace standard browser confirmation prompts with custom modals Replace browser native dialogs with Bootstrap modal system Nov 4, 2025
Copilot AI requested a review from itshypax November 4, 2025 03:11
@itshypax
itshypax marked this pull request as ready for review November 4, 2025 03:14
@itshypax
itshypax merged commit 91f1baf into update Nov 4, 2025
@itshypax
itshypax deleted the copilot/replace-confirmation-prompts branch November 4, 2025 03:14
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.

2 participants