From 21fa2074754b982596c1e7ce8c6c1841c42ded65 Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Fri, 21 Oct 2022 10:18:23 -0400 Subject: [PATCH] TableOutputComponent: Reset navigating selection if new search Reset the selection once upon navigating, when a new search just happened. Before this change, navigating to the next filtered entry in the table, after a new yet differing search, didn't select the first newly highlighted entry. Now, upon the user updating a search filter, the proper (first) filtered entry gets selected next. This doesn't address the issue with Enter being hit quickly while editing Search field(s). That remains to be fixed as follow-up. This however fixes the case of hitting Enter less quickly while in Search. Contributes to fixing #859. Signed-off-by: Marco Miller --- .../src/components/table-output-component.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/react-components/src/components/table-output-component.tsx b/packages/react-components/src/components/table-output-component.tsx index 615f85fa3..a21d4ba38 100644 --- a/packages/react-components/src/components/table-output-component.tsx +++ b/packages/react-components/src/components/table-output-component.tsx @@ -43,6 +43,7 @@ export class TableOutputComponent extends AbstractOutputComponent setTimeout(cb, msBetweenChecks)); } + if (this.gridSearched) { + // reset the selection once, upon new search filter just applied + this.selectStartIndex = this.selectEndIndex = -1; + this.gridSearched = false; + } // make sure that both index are either both -1 or both have a valid number if (this.selectStartIndex !== -1 && this.selectEndIndex === -1) {