-
-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make PostStreamScrubber work for Posts that have top margin #2369
Conversation
Hmm, I remember I was looking at this back when doing #2160, but didn't include it for some reason, don't remember why though. I'll test it locally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, this fixes the issue and doesn't seem to introduce any others. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good, but would it maybe be prettier to use two number variables and no boolean?
Pseudo-code:
indexFromViewPort = null;
$.each(() => {
// [...]
if (!indexFromViewPort) {
indexFromViewPort = parseFloat(...) + visibleTop/height
}
// [...]
})
// [...]
index = indexFromViewPort || $items.first().data() || 0
EDIT: I fixed my pseudo-code, the if
statement was missing
That looks nice! Could also get us a bit closer to the implementation needed for #1897, so I like it |
Will do, we need to check against null though both times, since zero can be a valid index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-tested locally, confirmed that it still works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it fixes both issues mentioned (only one is an actual issue in the repo). Tested locally 👍
Basically the same as #1944. I now know what that PR was fixing. When Posts have a top margin the scrubber will bounce around.
To replicate go to https://nightly.flarum.site, set
margin-top: 50px
for.Post
in the dev console. See scrubber bouncing back and forth when scrolling.Not a priority, but should still be fixed I think.
Edit: New commit fixes #1897
Confirmed