diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 9ec2bf0d45..ad749295ae 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -259,15 +259,24 @@ module.exports = React.createClass({ if (firstTime) { // scroll to make sure the callbox is on the screen... - if (top < 10) { + if (top < 10) { // 10px of vertical margin at top of screen scroll.scrollTop = incomingCallBox.parentElement.offsetTop - 10; } - else if (top > scroll.clientHeight - incomingCallBox.offsetHeight) { - scroll.scrollTop = incomingCallBox.parentElement.offsetTop - scroll.offsetHeight + incomingCallBox.offsetHeight; + else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) { + scroll.scrollTop = incomingCallBox.parentElement.offsetTop - scroll.offsetHeight + incomingCallBox.offsetHeight - 50; } // recalculate top in case we clipped it. top = (scroll.offsetTop + incomingCallBox.parentElement.offsetTop - scroll.scrollTop); } + else { + // stop the box from scrolling off the screen + if (top < 10) { + top = 10; + } + else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) { + top = scroll.clientHeight - incomingCallBox.offsetHeight + 50; + } + } incomingCallBox.style.top = top + "px"; incomingCallBox.style.left = scroll.offsetLeft + scroll.offsetWidth + "px";