From 7631539584a963793501011bd3489838047f2758 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Sun, 28 Aug 2016 11:39:47 +0100 Subject: [PATCH] Fixed incorrect init calculation of originalPosition attribute --- src/components/views/rooms/RoomList.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 78f0587d1c..9f10d51d82 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -320,6 +320,8 @@ module.exports = React.createClass({ _initAndPositionStickyHeaders: function(initialise, scrollToPosition) { var scrollArea = this._getScrollNode(); + // Use the offset of the top of the scroll area from the window + // as this is used to calculate the CSS fixed top position for the stickies var scrollAreaOffset = scrollArea.getBoundingClientRect().top; var scrollAreaHeight = scrollArea.getBoundingClientRect().height; @@ -335,7 +337,11 @@ module.exports = React.createClass({ if (typeof stickies === "object" && stickies.length > 0) { // Initialise the sticky headers this.stickyWrappers = Array.prototype.map.call(stickies, function(sticky, i) { - sticky.dataset.originalPosition = sticky.offsetTop - scrollAreaOffset; + // Save the positions of all the stickies within scroll area. + // These positions are relative to the LHS Panel top + sticky.dataset.originalPosition = sticky.offsetTop - scrollArea.offsetTop; + + // Save and set the sticky heights var originalHeight = sticky.getBoundingClientRect().height; sticky.dataset.originalHeight = originalHeight; sticky.style.height = originalHeight;