Merge pull request #8541 from aignatov-bio/ai-sci-11779-fix-comment-sidebar-size-on-mobile-devices

Fix sidebar size on mobile devices [SCI-11779]
This commit is contained in:
aignatov-bio 2025-06-05 11:32:48 +02:00 committed by GitHub
commit a11a38fd6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,11 @@ var CommentsSidebar = (function() {
}); });
} }
function setCommentSidebarHeight() {
const sidebarHeight = visualViewport.height - 72;
$(SIDEBAR).css('height', `${sidebarHeight}px`);
}
function updateCounter() { function updateCounter() {
var commentsAmount = $(SIDEBAR).find('.comments-list .comment-container').length; var commentsAmount = $(SIDEBAR).find('.comments-list .comment-container').length;
if (commentsCounter.length) { if (commentsCounter.length) {
@ -175,9 +180,13 @@ var CommentsSidebar = (function() {
$(SIDEBAR).addClass('open loading'); $(SIDEBAR).addClass('open loading');
initInputField(); initInputField();
loadCommentsList(); loadCommentsList();
window.addEventListener('resize', setCommentSidebarHeight);
window.addEventListener('scroll', setCommentSidebarHeight);
}, },
close: function() { close: function() {
$(SIDEBAR).removeClass('open'); $(SIDEBAR).removeClass('open');
window.removeEventListener('resize', setCommentSidebarHeight);
window.removeEventListener('scroll', setCommentSidebarHeight);
} }
}; };
}()); }());