View Issue Details

IDProjectCategoryView StatusLast Update
0012019Talermerchant portal webuipublic2026-11-18 17:07
Reporterbot-cg [agent]  
CommunicatorCM_7  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
Target Version1.6Fixed in Version1.6 
Summary0012019: Merchant: Delete Order confirmation leaves focus behind the overlay (and Escape does nothing)
DescriptionWhat happens:
Order detail -> '•••' (Order actions) -> 'Delete Order' shows a hand-made role=dialog overlay. RowActions returns focus to its '•••' trigger behind the overlay, so focus is outside the dialog; the dialog's Escape handler sits on its own onKeyDown, so Escape did not close it either (measured: still open).

Expected:
Focus starts inside the confirmation on its safe choice, Cancel (never on 'Confirm Delete').

Where:
  - packages/taler-merchant-webui/src/screens/OrderDetailScreen.tsx:167
  - packages/taler-merchant-webui/src/screens/OrderDetailScreen.tsx:417

Measured in headless Chromium (document.activeElement):
  before: BUTTON 'Order actions' (•••, behind the overlay); Escape: dialog stays open
  after: BUTTON 'Cancel' inside the dialog; Escape closes it

Proposed fix:
Ref on the Cancel button and an effect on showDeleteModal that focuses it when the dialog opens; as a side effect the dialog's existing Escape handler now works.

Patch against taler-typescript-core master attached; the same change is committed on branch dev/bots/autofocus (durian). Screenshots attached (focused element outlined in red): 'before' is master, 'after' is with the patch.

Verified: tsc ok for file; screens.test.js passes; screenshot confirms
TagsNo tags attached.
Attached Files
merchant-b--order-detail-delete-dialog.diff (1,748 bytes)   
diff --git a/packages/taler-merchant-webui/src/screens/OrderDetailScreen.tsx b/packages/taler-merchant-webui/src/screens/OrderDetailScreen.tsx
index ac00362c8..7ed05d14f 100644
--- a/packages/taler-merchant-webui/src/screens/OrderDetailScreen.tsx
+++ b/packages/taler-merchant-webui/src/screens/OrderDetailScreen.tsx
@@ -16,7 +16,7 @@
 
 import { useLocation } from "wouter-preact";
 import type { VNode } from "preact";
-import { useEffect, useState } from "preact/hooks";
+import { useEffect, useRef, useState } from "preact/hooks";
 import { Header } from "../ui/Header.js";
 import { TalerQrCode } from "../ui/TalerQrCode.js";
 import { ApiErrorBanner } from "../ui/ApiErrorBanner.js";
@@ -162,6 +162,12 @@ export function OrderDetailScreen({
   const [forceDelete, setForceDelete] = useState<boolean>(false);
   const [isDeleting, setIsDeleting] = useState<boolean>(false);
   const [deleteError, setDeleteError] = useState<string>("");
+  // Open the confirmation on its safe choice. The dialog only hears Escape
+  // while focus is inside it, and the menu that opens it leaves focus behind.
+  const deleteCancel = useRef<HTMLButtonElement>(null);
+  useEffect(() => {
+    if (showDeleteModal) deleteCancel.current?.focus();
+  }, [showDeleteModal]);
 
   const [now, setNow] = useState<AbsoluteTimeValue>(
     nowProp ?? AbsoluteTime.now(),
@@ -408,6 +414,7 @@ export function OrderDetailScreen({
             </label>
             <div class="flex space-x-3 pt-2">
               <button
+                ref={deleteCancel}
                 onClick={() => setShowDeleteModal(false)}
                 class="flex-1 px-4 py-2 text-xs font-bold bg-gray-100 rounded-lg hover:bg-gray-200 cursor-pointer"
               >{t`Cancel`}</button>

Required notifications

Address or linkRemarkAdded byNotifiedActions

Relationships

child of 0012002 closed Merchant portal: dialogs, PIN/code prompts and single-purpose forms open without keyboard focus on the obvious field 

Activities

bot-codex-florian-dold

2026-11-13 09:11

manager   ~0030468

commit 073d2e7f48bb3ba51738e900ae533a2e0dc80876
Author: Florian Dold <dold@taler.net>
Date: Fri Nov 13 01:06:16 2026 +0100

    merchant web UI: use shared focus handling for custom dialogs
    
    Move pairing, account removal, order deletion and template overlays to
    Modal. Keep their content and dismissal behavior, and mark the intended
    field in report-group dialogs.
    
    Issue: https://bugs.taler.net/n/12005
    Issue: https://bugs.taler.net/n/12018
    Issue: https://bugs.taler.net/n/12019
    Issue: https://bugs.taler.net/n/12020
    Issue: https://bugs.taler.net/n/12021
    Assisted-by: LLM

commit c58cf2ae54417fe5d5cab9075ff3d88e52f3796b
Author: Florian Dold <dold@taler.net>
Date: Fri Nov 13 01:06:16 2026 +0100

    merchant web UI: share dialog and menu focus handling
    
    Let Modal choose its initial target and use DialogFocusScope for Tab,
    Escape and restoration. Keep confirmations on their safe action and pass
    the row menu trigger through menu-to-dialog handoffs.
    
    Issue: https://bugs.taler.net/n/12004
    Assisted-by: LLM

commit 0db14837db18a79a4bee3ca81c0137bc20c01f92
Author: Florian Dold <dold@taler.net>
Date: Fri Nov 13 01:06:14 2026 +0100

    web-util: restore dialog openers and coordinate nested dialogs
    
    DialogFocusScope adds Escape handling and opener restoration to a focus
    scope. Hooks provide the same behavior for existing wrappers. Menus
    restore focus without trapping it; native dialogs retain browser Tab
    handling.
    
    After an initial request succeeds, discard the other eligible requests,
    including ones tried earlier while their controls were unavailable. Keep
    requests blocked by a modal and requests waiting after fallback focus.
    
    Issue: https://bugs.taler.net/n/12002
    Issue: https://bugs.taler.net/n/12024
    Issue: https://bugs.taler.net/n/12034
    Assisted-by: LLM

Issue History

Date ModifiedUsernameFieldChange
2026-11-10 23:41bot-cgNew Issue
2026-11-10 23:41bot-cgRelationship addedchild of 0012002
2026-11-10 23:43bot-cgFile Added: merchant-b--order-detail-delete-dialog.diff
2026-11-10 23:43bot-cgFile Added: merchant-b--order-detail-delete-dialog--before.png
2026-11-10 23:43bot-cgFile Added: merchant-b--order-detail-delete-dialog--after.png
2026-11-11 08:25Christian GrothoffSeverityminor => trivial
2026-11-13 09:11bot-codex-florian-doldNote Added: 0030468
2026-11-13 09:12bot-codex-florian-doldStatusnew => closed
2026-11-13 09:12bot-codex-florian-doldResolutionopen => fixed
2026-11-18 17:03Christian GrothoffTarget Version => 1.6
2026-11-18 17:07Christian GrothoffFixed in Version => 1.6