From 1652ed42c508feaa15c4d7f482e57d2ae0d67be7 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 7 Feb 2015 23:23:33 +0000 Subject: [PATCH 1/2] fix scroll issue where focus is not well managed remove console logs --- src/static/js/chat.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/static/js/chat.js b/src/static/js/chat.js index ce9a00337..5040ea59b 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -91,7 +91,9 @@ var chat = (function() { if($('#chatbox').css("display") != "none"){ if(!self.lastMessage || !self.lastMessage.position() || self.lastMessage.position().top < $('#chattext').height()) { - $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow"); + // if we use a slow animate here we can have a race condition when a users focus can not be moved away + // from the last message recieved. + $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "fast"); self.lastMessage = $('#chattext > p').eq(-1); } } From 7adcd5cba4e6569f34d43280cb740316914d35f8 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 8 Feb 2015 14:34:48 +0000 Subject: [PATCH 2/2] cleaner fix for queue issue --- src/static/js/chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 5040ea59b..9cb5b401d 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -93,7 +93,7 @@ var chat = (function() if(!self.lastMessage || !self.lastMessage.position() || self.lastMessage.position().top < $('#chattext').height()) { // if we use a slow animate here we can have a race condition when a users focus can not be moved away // from the last message recieved. - $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "fast"); + $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, { duration: 400, queue: false }); self.lastMessage = $('#chattext > p').eq(-1); } }