View Issue Details

IDProjectCategoryView StatusLast Update
0012054Talerwallet (WebExtension)public2026-11-18 17:07
Reporterbot-cg [agent]  
CommunicatorCM_7  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
Target Version1.6Fixed in Version1.6 
Summary0012054: Wallet: shared ConfirmationDialog focuses an extra body action instead of Cancel (durability prompt)
DescriptionWhat happens:
ConfirmationDialog focused the first focusable element in the dialog. For the PWA durability prompt ('Protect wallet data before continuing', src/platform/durability.tsx, shown before money actions when storage is not persistent) the children contain 'Install PWA' and 'Database export and import' buttons before the actions, so focus landed on 'Install PWA' (or on 'Database export and import', which cancels the pending action and navigates away, when install is unavailable). Rendered with the same children: activeElement BUTTON 'Install PWA'.

Expected:
A field the dialog asks for if any (e.g. the 'I understand' acknowledgement checkbox), otherwise the safe Cancel button; never the confirming action or an extra action.

Where:
  - packages/wallet-webui/src/ui/ConfirmationDialog.tsx:41

Measured in headless Chromium (document.activeElement):
  before: BUTTON 'Install PWA'
  after: BUTTON 'Cancel'

Proposed fix:
On open, focus the first enabled input/select/textarea in the dialog, else the cancel button (first button of the actions row), else the dialog container. Tab trapping is unchanged.

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 (0 errors in wallet-webui with workspace sources; plain `tsc --noEmit -p .` output identical to baseline, whose errors come from stale taler-util/wallet-core lib/); eslint + prettier clean on changed files; package tests screens/exchange-removal/payment-entry/routing bundled from src: 89/95 pass, the same 6 App-level demo tests fail before and after; scratch test: plain -> Cancel, extra button -> Cancel, checkbox -> checkbox; exchange-delete story still focuses its acknowledgement checkbox (wallet--exchange-delete-dialog--*.png); demo reset dialog still Cancel. Call sites: durability prompt (changed), TransactionDetailScreen x2, SettingsScreen x3, ExchangeDetailScreen x2, BankAccountsScreen, PaymentScreen, DemoBanner (unchanged result).
TagsNo tags attached.
Attached Files
wallet--confirmation-dialog.diff (1,883 bytes)   
diff --git a/packages/wallet-webui/src/ui/ConfirmationDialog.tsx b/packages/wallet-webui/src/ui/ConfirmationDialog.tsx
index 32844defa..72ce55961 100644
--- a/packages/wallet-webui/src/ui/ConfirmationDialog.tsx
+++ b/packages/wallet-webui/src/ui/ConfirmationDialog.tsx
@@ -25,6 +25,7 @@ export function ConfirmationDialog(props: {
   onConfirm: () => void;
 }) {
   const dialogRef = useRef<HTMLDivElement>(null);
+  const actionsRef = useRef<HTMLDivElement>(null);
   const previousFocus = useRef<HTMLElement | null>(null);
   const onCancel = useRef(props.onCancel);
   const working = useRef(props.working);
@@ -38,8 +39,15 @@ export function ConfirmationDialog(props: {
         ? document.activeElement
         : null;
     const dialog = dialogRef.current;
-    const first = dialog ? focusableElements(dialog)[0] : undefined;
-    first?.focus();
+    // Start on the first field the dialog asks for, otherwise on the cancel
+    // button: neither the confirming action nor an extra action placed in
+    // the body should be what Enter triggers by default.
+    const cancel = actionsRef.current?.querySelector("button");
+    const initial =
+      dialog?.querySelector<HTMLElement>(
+        "input:not([disabled]), select:not([disabled]), textarea:not([disabled])",
+      ) ?? (cancel && !cancel.disabled ? cancel : dialog);
+    initial?.focus();
     const onKeyDown = (event: KeyboardEvent) => {
       if (event.key === "Escape" && !working.current) {
         event.preventDefault();
@@ -98,7 +106,7 @@ export function ConfirmationDialog(props: {
             {props.description}
           </div>
           {props.children}
-          <div class="mt-6 flex flex-wrap justify-end gap-3">
+          <div ref={actionsRef} class="mt-6 flex flex-wrap justify-end gap-3">
             <Button
               tone="secondary"
               onClick={props.onCancel}

Required notifications

Address or linkRemarkAdded byNotifiedActions

Relationships

child of 0012024 closed Web UIs (bank, wallet, exchange AML/KYC, challenger, auditor, web-util forms): dialogs and single-purpose forms open without keyboard focus on the obvious field 

Activities

bot-codex-florian-dold

2026-11-13 09:13

manager   ~0030501

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

    wallet web UI: focus active forms, menus and confirmations
    
    Focus amount and account fields when their forms are ready. Restore menu
    and dialog openers, and leave focus alone during background updates.
    
    Confirmations start on an editable field, including acknowledgement
    checkboxes and selects, or Cancel when there is no field to fill in.
    
    Issue: https://bugs.taler.net/n/12024
    Issue: https://bugs.taler.net/n/12054
    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:42bot-cgNew Issue
2026-11-10 23:42bot-cgRelationship addedchild of 0012024
2026-11-10 23:43bot-cgFile Added: wallet--confirmation-dialog.diff
2026-11-10 23:43bot-cgFile Added: wallet--confirmation-dialog--before.png
2026-11-10 23:43bot-cgFile Added: wallet--confirmation-dialog--after.png
2026-11-11 16:28Christian GrothoffSeveritytweak => trivial
2026-11-13 09:13bot-codex-florian-doldNote Added: 0030501
2026-11-13 09:13bot-codex-florian-doldStatusnew => closed
2026-11-13 09:13bot-codex-florian-doldResolutionopen => fixed
2026-11-18 17:02Christian GrothoffTarget Version => 1.6
2026-11-18 17:07Christian GrothoffFixed in Version => 1.6