feat(ux): Esc-to-cancel + type-to-confirm for destructive actions (PMS-369) #259
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-369-confirm-esc-type-to-confirm"
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?
What
Closes the three remaining ACs of PMS-369. The destructive-confirmation sweep was already broad on main (
ConfirmDialogwired across 11 pages, incl. the SLA "Remove" the review named), so AC1/AC2 were satisfied; this adds Esc, type-to-confirm, the test, and the doc.Changes
Modalnow focuses itself on mount (tabindex=-1+set_focus) and firesoncloseonEscape, so every confirm/modal cancels on Esc - on top of the existing backdrop-click and Cancel.ConfirmDialoggains an optionalconfirm_phrase. When set, the destructive button stays disabled until the user types the entity's name. Gate logicconfirm_phrase_satisfied(exact match, trimmed, case-insensitive) is unit-tested. Wired the SPA's one cascading delete - delete company (removes its sites, unlinks contacts/tickets) - to require typing the company name. There is no tenant-delete in the SPA (admin tenant page is a read-only roster).confirm_phrase_satisfied. DOM-interaction tests (click -> modal -> DELETE) are not supported by the host-sidecargo test --libharness (no wasm/browser runner is set up); noted in the doc.dev-docs/destructive-actions.md(companion toform-conventions.md) - the confirm convention, simple-vs-type-to-confirm line, current coverage, and the testing limitation.AC mapping
Verification
wasm
cargo check,cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings,cargo fmt --all --check, andcargo test --lib modal::tests(2 passed) all pass.#PMS-369