From 43d719c62cb51df880bd6e4fe9d18f685967d653 Mon Sep 17 00:00:00 2001 From: Sulthan Zaki Date: Thu, 30 Jul 2026 22:15:43 +0700 Subject: [PATCH] Open the remove confirm on Cancel, not on Remove MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moving focus into an opened confirm row took the first button in DOM order, which is the affirmative in all three rows — so the one irreversible action opened with its destructive button pre-armed and a stray Enter would fire it. That inverts the point of the gate the row exists to be. The reversible rows still open on their affirmative; remove opens on Cancel. Co-Authored-By: Claude Opus 5 --- backend/static/filter.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/static/filter.js b/backend/static/filter.js index 4e27c1e..3cddea3 100644 --- a/backend/static/filter.js +++ b/backend/static/filter.js @@ -106,7 +106,12 @@ function toggleConfirmRow(key, kind) { // unhides: it makes the announcement deterministic, keeps tab order inside // the confirm instead of running on into the next card, and means the row // cannot be opened and scrolled past unnoticed. - if (row && !row.hidden) row.querySelector("button").focus(); + // The reversible rows open on their affirmative; remove opens on Cancel. + // Focusing the first button in DOM order would hand the irreversible action + // a pre-armed Enter, which is the opposite of what a confirm gate is for. + if (row && !row.hidden) { + row.querySelector(row.classList.contains("calm") ? "button" : "button + button").focus(); + } } // Esc closes whichever panel this card has open and hands focus back to the