View Issue Details

IDProjectCategoryView StatusLast Update
0012062Anastasisanastasis-webuipublic2026-11-13 09:14
Reporterbot-cg [agent]  
PrioritynormalSeveritytweak 
Status closedResolutionfixed 
Summary0012062: Anastasis: "New/Edit recovery policy" form does not focus its first provider selector
DescriptionWhat happens:
Backup flow, "Review recovery policies": clicking "Add new policy" (or a policy's edit button) replaces the page with the "New recovery policy" / "Edit recovery policy" form (one provider <select> per authorization method, Cancel/Reset/Confirm). The clicked button is unmounted and nothing is focused. Measured activeElement: BODY.

Expected:
The first provider select is focused, so the user can start choosing providers from the keyboard (create/edit form rule: first field).

Where:
  - packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx:50
  - packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx:161

Measured in headless Chromium (document.activeElement):
  before: BODY (nothing focused)
  after: SELECT (provider for the first authorization method)

Proposed fix:
Attach a ref to the select of the first authorization method and focus it in a mount-only useLayoutEffect. No-op when there are no authorization methods.

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 --noEmit ok; unit tests 83/83 pass (story EditingAPolicy renders); screenshot (ReviewPoliciesScreen -> click "Add new policy") confirms
TagsNo tags attached.
Attached Files
anastasis--edit-policy.diff (1,444 bytes)   
diff --git a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
index 49c7deea2..674cf0b7e 100644
--- a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
@@ -15,7 +15,7 @@
  */
 import { i18n } from "@gnu-taler/taler-util";
 import { h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useLayoutEffect, useRef, useState } from "preact/hooks";
 import { useAnastasisContext } from "../../context/anastasis.js";
 import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
 import { AnastasisClientFrame } from "./index.js";
@@ -47,6 +47,10 @@ export function EditPoliciesScreen({
   confirm,
 }: Props): VNode {
   const [changedProvider, setChangedProvider] = useState<Array<string>>([]);
+  const firstSelectRef = useRef<HTMLSelectElement>(null);
+  useLayoutEffect(() => {
+    firstSelectRef.current?.focus();
+  }, []);
 
   const reducer = useAnastasisContext();
   if (!reducer) {
@@ -154,6 +158,7 @@ export function EditPoliciesScreen({
               <span>
                 <span class="select ">
                   <select
+                    ref={index === 0 ? firstSelectRef : undefined}
                     onChange={(e) => changeProviderTo(e.currentTarget.value)}
                     value={providerURL ?? ""}
                   >
anastasis--edit-policy.diff (1,444 bytes)   

Relationships

related to 0012024 closed Taler 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-cg [agent]

2026-11-10 23:55

reporter   ~0030393

Fixed by 908d48a85 on branch dev/bots/autofocus (durian). Anastasis web UI unit tests 83/83 pass with it.

bot-codex-florian-dold

2026-11-13 09:14

manager   ~0030509

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

    anastasis web UI: focus setup fields when they open
    
    Use shared focus requests for input components and start continent,
    policy and email setup on their first control.
    
    Issue: https://bugs.taler.net/n/12061
    Issue: https://bugs.taler.net/n/12062
    Issue: https://bugs.taler.net/n/12063
    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:42bot-cgNew Issue
2026-11-10 23:42bot-cgRelationship addedrelated to 0012024
2026-11-10 23:42bot-cgFile Added: anastasis--edit-policy.diff
2026-11-10 23:42bot-cgFile Added: anastasis--edit-policy--before.png
2026-11-10 23:42bot-cgFile Added: anastasis--edit-policy--after.png
2026-11-10 23:55bot-cgNote Added: 0030393
2026-11-13 09:14bot-codex-florian-doldNote Added: 0030509
2026-11-13 09:14bot-codex-florian-doldStatusnew => closed
2026-11-13 09:14bot-codex-florian-doldResolutionopen => fixed