Components
← All components

Confirm Bridge

stimeo--confirm

Replaces Turbo's native confirm() with an accessible alert dialog.

  • Alert & Message Dialog
  • Rails / Turbo

The stimeo--confirm controller replaces the native window.confirm() that Turbo uses for data-turbo-confirm with an accessible alert dialog (WAI-ARIA APG Alert Dialog pattern), reusing the shared FocusTrap so the trap, focus restore, and Escape-to-cancel are not reimplemented. On connect it swaps Turbo.config.forms.confirm for a Promise-returning method and restores the original on disconnect (Turbo navigation included), so registration never leaks or stacks. It can also intercept any link/button via the request action and continue the original submit/navigation only when confirmed. The least destructive button (cancel) takes initial focus; Escape cancels. When no dialog is present it degrades to native confirm. It dispatches stimeo--confirm:open and :resolve. Behavior only — the dialog markup and styling belong to this Playground.

running

Keyboard

KeyAction
Esc Cancels (resolves false) and closes the dialog.
Tab / Shift+Tab Cycles focus within the dialog (focus trap).
Enter Activates the focused confirm or cancel button.