From 63c9d790312ffdd3e513dde8997d497dc547d90c Mon Sep 17 00:00:00 2001
From: Lukas Haase <lukas.haase@mni.thm.de>
Date: Thu, 22 Apr 2021 15:53:23 +0200
Subject: [PATCH] when commentsfilter empty, do not show any comment

---
 .../questionwall/question-wall/question-wall.component.ts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.ts b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
index 8e3123fe6..cacfa01c6 100644
--- a/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
+++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
@@ -299,7 +299,13 @@ export class QuestionWallComponent implements OnInit, AfterViewInit, OnDestroy {
     this.filterFunction = filter;
     this.commentsFilter = this.commentsFilteredByTime.filter(this.filterFunction);
     this.hasFilter = true;
-    setTimeout(() => this.focusFirstComment(), 0);
+    setTimeout(() => {
+      if (this.commentsFilter.length <= 0) {
+        this.commentFocus = null;
+      } else {
+        this.focusFirstComment();
+      }
+    }, 0);
   }
 
   focusFirstComment() {
-- 
GitLab