Repository navigation
Replace native confirm() dialogs with a themed modal - #60
Merged
Merged
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.
Replace the browser's native
confirm()dialogs with a themed in-page modal for allhx-confirm-guarded actions: bookmark delete, nested sub-command delete, API token revoke, and admin user delete.How it works: htmx fires an
htmx:confirmevent before falling back to the native dialog. The newstatic/js/confirm.jsintercepts that event, shows the modal frombase.html(message from thehx-confirmattribute, Cancel / Confirm buttons), and on confirm calls the event'sissueRequest(true)to let the held request proceed. Thehx-confirmattributes themselves are untouched — this only replaces the presentation, so the guards and their wording stay exactly as they were. Pages without the modal markup keep the native behavior as a fallback. Cancel via the Cancel button, the backdrop, or Escape.Why: the native dialogs were the only unthemed UI left in the app, and they can't be driven by browser automation — the Oct 18 post-deploy regression run couldn't revoke its own test API token because the native dialog auto-dismissed. The modal fixes both.
Tests: new
tests/confirm_modal_test.rspins the served pieces (modal markup + buttons + script tag on pages;confirm.jsserved and interceptinghtmx:confirm; modal styles inmain.css). The click-through behavior (open → cancel keeps the bookmark; open → confirm deletes it, no native dialog) was verified with Playwright against a local server.