Admin confirm modal without external dependency - #6528
Draft
forkata wants to merge 11 commits into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6528 +/- ##
==========================================
- Coverage 92.14% 91.37% -0.78%
==========================================
Files 1035 752 -283
Lines 21151 16443 -4708
==========================================
- Hits 19490 15025 -4465
+ Misses 1661 1418 -243 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
* adds possibility to conditionally open modal on connect - use stimulus value instead of Dialog's "open" attribute (applying attribute directly on dialog element is discouraged by HTML specification https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/open#value); * adds identifier classes to title ".modal-title" and body ".modal-body" so that turbo-confirm can target them correctly; * adds "empty:hidden" so that when no content is passed the empty div does not take space in the modal;
Updates several components to use "data-turbo-confirm" and new confirmation dialog instead of native browser confirm. Removes redundant confirm_controller.js.
Use plain DOM calls to update the confirm dialog markup and show the confirmation modal. This change also pins the new module in the importmap so the bare specifier resolves. Co-authored-by: Senem Soy <senem@super.gd> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Move DOM manipulation out of confirm_modal.js and into a proper component.js Stimulus controller for layout/confirm, attached via data-controller on a wrapper around the modal. confirm_modal.js is now a thin adapter that looks up the controller instance and calls its `open` method, matching how the rest of the admin's per-component JS is structured (e.g. ui/modal, ui/table). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
forkata
force-pushed
the
admin-confirm-modal
branch
from
August 6, 2026 17:53
2c8cc4e to
4a62172
Compare
Co-authored-by: Senem Soy <senem@super.gd>
forkata
force-pushed
the
admin-confirm-modal
branch
from
August 6, 2026 20:27
4a62172 to
4c08167
Compare
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.
Summary
This change addresses the concerns raised in the original PR #6295 re: adding an additional dependency.
In this change we dropped the dependency on https://github.com/RoleModel/turbo-confirm and instead wire the new confirm component directly. There are two additional changes in this PR from the original, the first is just a plain JS function to achieve this, and the last commit tries to refactor that into a Stimulus JS controller. The final approach still uses query selectors to target the dialog title and body but we could potentially refactor the the modal UI component to allow us to pass Stimulus target references down. We did not go as far as doing that in this PR.
We also noticed that our modal component has a
data-controllerreference on it, but we do not have a modal controller defined for that so we've removed it in the last commit to reduce confusion and allow the new parent controller to not conflict with that if we do decide to inject targets in the future.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: