From b6cc95a0e1fe8a96f31f4546ce33e8f2c688239d Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 28 May 2024 12:14:15 +0100 Subject: [PATCH] UX: Make sticky avatars behavior consistent (#27223) Previously, avatars would be 'sticky' when: 1. The post was longer than the viewport OR 2. You were scrolling up The difference in behavior based on scroll direction doesn't 'feel' quite right. This commit makes the behavior consistent, so sticky avatar logic is applied to all posts regardless of scroll direction. --- .../discourse/app/modifiers/sticky-avatars.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/app/modifiers/sticky-avatars.js b/app/assets/javascripts/discourse/app/modifiers/sticky-avatars.js index 9d821dc267e..6c3ec4bdef2 100644 --- a/app/assets/javascripts/discourse/app/modifiers/sticky-avatars.js +++ b/app/assets/javascripts/discourse/app/modifiers/sticky-avatars.js @@ -122,14 +122,7 @@ export default class StickyAvatars extends Modifier { return; } - const postContentHeight = - entry.target.querySelector(".contents")?.clientHeight; - if ( - this.direction === "⬆️" || - postContentHeight > window.innerHeight - offset - ) { - entry.target.classList.add(STICKY_CLASS); - } + entry.target.classList.add(STICKY_CLASS); }); }, {