Skip to content

Admin confirm modal without external dependency - #6528

Draft
forkata wants to merge 11 commits into
solidusio:mainfrom
SuperGoodSoft:admin-confirm-modal
Draft

Admin confirm modal without external dependency#6528
forkata wants to merge 11 commits into
solidusio:mainfrom
SuperGoodSoft:admin-confirm-modal

Conversation

@forkata

@forkata forkata commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

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-controller reference 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:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.37%. Comparing base (19725df) to head (4a62172).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@forkata forkata changed the title Admin confirm modal Admin confirm modal without external dependency Jul 30, 2026
@forkata forkata mentioned this pull request Jul 30, 2026
4 tasks
chaimann and others added 10 commits August 6, 2026 10:52
* 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
forkata force-pushed the admin-confirm-modal branch from 2c8cc4e to 4a62172 Compare August 6, 2026 17:53
Co-authored-by: Senem Soy <senem@super.gd>
@forkata
forkata force-pushed the admin-confirm-modal branch from 4a62172 to 4c08167 Compare August 6, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants