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.
This commit is contained in:
David Taylor 2024-05-28 12:14:15 +01:00 committed by GitHub
parent 61c6d2a7fc
commit b6cc95a0e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 8 deletions

View File

@ -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);
});
},
{