View Issue Details

IDProjectCategoryView StatusLast Update
0012012Talermerchant portal webuipublic2026-11-18 17:07
Reporterbot-cg [agent]  
CommunicatorCM_7  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
Target Version1.6Fixed in Version1.6 
Summary0012012: Merchant: 'Create Machine Access' does not focus 'Used for'
DescriptionWhat happens:
Access -> '+ Create machine access' opens the form; focus is on BODY.

Expected:
Focus 'Used for', the first (required) field.

Where:
  - packages/taler-merchant-webui/src/screens/CreateAccessScreen.tsx:123

Measured in headless Chromium (document.activeElement):
  before: BODY
  after: INPUT#acc_used_for

Proposed fix:
Ref on #acc_used_for focused on mount.

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; eslint clean; screenshot confirms; routes/createAccess.test same pre-existing env failures with and without the change
TagsNo tags attached.
Attached Files
merchant-a--create-access.diff (1,473 bytes)   
diff --git a/packages/taler-merchant-webui/src/screens/CreateAccessScreen.tsx b/packages/taler-merchant-webui/src/screens/CreateAccessScreen.tsx
index cd1c3d60c..d15ac9d5d 100644
--- a/packages/taler-merchant-webui/src/screens/CreateAccessScreen.tsx
+++ b/packages/taler-merchant-webui/src/screens/CreateAccessScreen.tsx
@@ -15,7 +15,7 @@
  */
 
 import type { VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useRef, useState } from "preact/hooks";
 import { useLocation } from "wouter-preact";
 import { Header } from "../ui/Header.js";
 import { useTranslation, type TranslateFn } from "../context/translation.js";
@@ -119,6 +119,11 @@ export function CreateAccessScreen({
 
   // Form State (Spec 02 § 2.6.1)
   const [usedFor, setUsedFor] = useState<string>("");
+  // New access starts with what it is for.
+  const usedForInput = useRef<HTMLInputElement>(null);
+  useEffect(() => {
+    usedForInput.current?.focus();
+  }, []);
   const [canDo, setCanDo] = useState<string>("take_payments");
   const [expires, setExpires] = useState<string>("30d");
   const [password, setPassword] = useState<string>("");
@@ -217,6 +222,7 @@ export function CreateAccessScreen({
                 {t`Used for`} <span class="text-red-500">*</span>
               </label>
               <input
+                ref={usedForInput}
                 {...fieldProps("acc_used_for")}
                 id="acc_used_for"
                 type="text"
merchant-a--create-access.diff (1,473 bytes)   

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:10

manager   ~0030461

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

    merchant web UI: focus creation and refund forms
    
    Choose the first field for products, devices, access, bank accounts,
    orders and reports. Wait for refund and bank-monitoring data before
    focusing their controls; select the suggested order amount.
    
    Issue: https://bugs.taler.net/n/12006
    Issue: https://bugs.taler.net/n/12011
    Issue: https://bugs.taler.net/n/12012
    Issue: https://bugs.taler.net/n/12013
    Issue: https://bugs.taler.net/n/12014
    Issue: https://bugs.taler.net/n/12015
    Issue: https://bugs.taler.net/n/12016
    Issue: https://bugs.taler.net/n/12017
    Assisted-by: LLM

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

    web-util: focus pages and form steps when their controls are ready
    
    FocusScope queues one initial focus request when a page, form or step
    opens. It waits for loading and cancels the request if the user moves
    focus. useFocusTarget retries pending focus when a control mounts.
    
    Explicit requestFocus calls run immediately and return success or
    failure.
    
    Issue: https://bugs.taler.net/n/12002
    Issue: https://bugs.taler.net/n/12024
    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-a--create-access.diff
2026-11-10 23:43bot-cgFile Added: merchant-a--create-access--before.png
2026-11-10 23:43bot-cgFile Added: merchant-a--create-access--after.png
2026-11-11 16:39Christian GrothoffSeveritytweak => trivial
2026-11-13 09:10bot-codex-florian-doldNote Added: 0030461
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