Dialog and confirmation components: one dialog pattern, one confirmation rule #615
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
security
technical improvement
UX Improvement
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
local-it/mitgliederverwaltung#615
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
There is no dialog component: 13 dialogs are hand-copied
<dialog class="modal modal-open">blocks with Escape wired in three different ways and focus return missing in five. Missingphx-targets caused a crash and Escape closing the wrong dialog (fixed minimally in U1). Four actions still use the browser'sdata-confirm. Five confirmation strengths exist without a rule, and there are three different ways to delete from a form. DESIGN_GUIDELINES §10.2–§10.4 define one dialog pattern and one confirmation rule.Visible improvement
Every dialog behaves the same: it opens above everything, Escape and the backdrop close it, focus goes in and comes back; confirmations ask exactly as much as the action warrants.
Scope (ordered steps,
just ci-devgreen after each)<.modal>: server-rendered<dialog>, opened withshowModal()via a colocated hook,JS.ignore_attributes("open"), backdrop<form method="dialog" class="modal-backdrop">, Escape/backdrop/Cancel →on_cancel, focus in on open,JS.push_focus/pop_focusfor focus return,aria-labelledby/aria-describedby, one title level and style. Component tests for open, Escape, focus return.<.confirm_dialog>on top: simple and typed confirmation (type_to_confirm, affected count shown as a warning callout, confirm disabled until the string matches),dangerconfirm for destructive actions.danger).data-confirm: fee type delete (moves to the Danger zone of the fee type edit page, per §14) and join request approve/reject (decide whether they need a confirmation; if yes, the simple dialog).?confirm_delete=1navigation (group form) and the parent-dialog message (data fields). Every delete handler re-checks:destroyon the server with the actor and deletes the record held in assigns, not one named by an id from the event (DESIGN_GUIDELINES §14, Authorization visibility).data-confirmand raw dialog markup to zero.Out of scope
Acceptance criteria
data-confirmand no rawmodalmarkup remain in views.Phoenix.LiveViewTest); for each delete flow, a forged delete event from an actor without destroy permission deletes nothing; component tests cover Escape and focus return.just ci-devgreen after every step.Dependencies
Anchors (verified against
main@d9093a1f, re-check before filing)lib/mv_web/live/member_live/show/membership_fees_component.ex:306,353,395,458lib/mv_web/live/member_live/show/deactivate_component.ex:77lib/mv_web/live/membership_fee_type_live/form.ex:154data-confirm:lib/mv_web/live/membership_fee_settings_live.ex:248(and the disabled variant nearby),lib/mv_web/live/join_request_live/show.ex:203,211lib/mv_web/live/group_live/form.ex:121lib/mv_web/live/custom_field_live/index_component.ex:112Caution
custom_field_live/deletion_test.exs,member_live/deactivate_test.exs,show_membership_fees_test.exs); keep dialog content server-rendered so they keep working.JS.ignore_attributes("open")must be set, or a LiveView patch closes an open dialog.