From ac8514473f4211d5b7785af74af8b8bd5d0d4740 Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Wed, 3 Nov 2021 15:49:32 +0100
Subject: [PATCH] fix(PreBarrage): loss of focus on input with existing result

- remove unselection of the child on schema refresh
- add unselection on remove child action to focus on the parent when a child is removed

Refs #469
---
 src/app/components/pb-schema/pb-schema.component.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/components/pb-schema/pb-schema.component.ts b/src/app/components/pb-schema/pb-schema.component.ts
index 0ba88a7ba..eab19cd1f 100644
--- a/src/app/components/pb-schema/pb-schema.component.ts
+++ b/src/app/components/pb-schema/pb-schema.component.ts
@@ -451,6 +451,7 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni
             }
         }
         this.clearResults();
+        this.unselect();
         this.refreshWithSelection();
         this.calculatorComponent.showPBInputData = true;
     }
@@ -668,7 +669,6 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni
         console.debug(`PbSchemaComponent.refreshWithSelection(${uid})`);
         // remember previously selected node
         const selectedNodeUID = this._selectedItem?.uid;
-        this.unselect();
         this.refresh();
         // select a specific node on the schema
         if (uid !== undefined) {
-- 
GitLab