From a1ff76f18fcb47ada6fa9d4676d1359e0ea58a24 Mon Sep 17 00:00:00 2001
From: Julia Radzhabova <julia.radzhabova@onlyoffice.com>
Date: Thu, 10 Nov 2022 14:24:17 +0300
Subject: [PATCH] Fix click on the comment popover

---
 apps/common/main/lib/controller/Comments.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js
index a5578ebea..ced3f5c69 100644
--- a/apps/common/main/lib/controller/Comments.js
+++ b/apps/common/main/lib/controller/Comments.js
@@ -980,13 +980,16 @@ define([
                     comment.set('hint', !_.isUndefined(hint) ? hint : false);
 
                     if (!hint && this.hintmode) {
-                        if (same_uids && (this.uids.length === 0))
+                        if (same_uids)
                             animate = false;
 
                         if (this.oldUids.length && (0 === _.difference(this.oldUids, uids).length) && (0 === _.difference(uids, this.oldUids).length)) {
                             animate = false;
                             this.oldUids = [];
                         }
+
+                        if (same_uids && !apihint && !this.isModeChanged)
+                            this.api.asc_selectComment(comment.get('uid'));
                     }
 
                     if (this.animate) {
@@ -1008,7 +1011,7 @@ define([
                 this.popoverComments.reset(comments);
 
                 if (this.popoverComments.findWhere({hide: false})) {
-                    if (popover.isVisible()) {
+                    if (popover.isVisible() && (!same_uids || this.isModeChanged)) {
                         popover.hide();
                     }