From 1bbe08378cccf8f2a630d76591c66a32974dc346 Mon Sep 17 00:00:00 2001 From: Garrett Ausfeldt Date: Thu, 17 Sep 2020 09:48:42 -0700 Subject: [PATCH] Fix focus when adding and removing a unique key (#214) * fix focus when adding and removing a unique key * cleanup Co-authored-by: REDMOND\gaausfel --- src/Explorer/Controls/DynamicList/DynamicListComponent.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Explorer/Controls/DynamicList/DynamicListComponent.ts b/src/Explorer/Controls/DynamicList/DynamicListComponent.ts index 4951f7cf3..cc699b4a0 100644 --- a/src/Explorer/Controls/DynamicList/DynamicListComponent.ts +++ b/src/Explorer/Controls/DynamicList/DynamicListComponent.ts @@ -86,6 +86,7 @@ export class DynamicListViewModel extends WaitsForTemplateViewModel { public onRemoveItemKeyPress = (data: any, event: KeyboardEvent, source: any): boolean => { if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) { this.removeItem(data, event); + (document.querySelector(".dynamicListItem:last-of-type input") as HTMLElement).focus(); event.stopPropagation(); return false; } @@ -94,7 +95,7 @@ export class DynamicListViewModel extends WaitsForTemplateViewModel { public addItem(): void { this.listItems.push({ value: ko.observable("") }); - document.getElementById("uniqueKeyItems").focus(); + (document.querySelector(".dynamicListItem:last-of-type input") as HTMLElement).focus(); } public onAddItemKeyPress = (source: any, event: KeyboardEvent): boolean => {