feat(Scroll to Bottom): Add preference to stop at Changes carousel#1752
Open
marcustyphoon wants to merge 25 commits intoAprilSylph:masterfrom
Open
feat(Scroll to Bottom): Add preference to stop at Changes carousel#1752marcustyphoon wants to merge 25 commits intoAprilSylph:masterfrom
marcustyphoon wants to merge 25 commits intoAprilSylph:masterfrom
Conversation
3d67da9 to
2927189
Compare
This comment was marked as resolved.
This comment was marked as resolved.
b8dfac8 to
ad58dd0
Compare
marcustyphoon
commented
Aug 20, 2025
Comment on lines
+97
to
+106
| const reliablyScrollToTarget = target => { | ||
| const callback = () => { | ||
| window.scrollBy({ top: target?.getBoundingClientRect?.()?.top }); | ||
| debouncedDisconnect(); | ||
| }; | ||
| const observer = new ResizeObserver(callback); | ||
| const debouncedDisconnect = debounce(() => observer.disconnect(), 500); | ||
| observer.observe(document.documentElement); | ||
| callback(); | ||
| }; |
Collaborator
Author
There was a problem hiding this comment.
do you ever look at a piece of code and go, "okay, that very obviously needs to be refactored to be simpler and shorter" but then see no way to actually do that?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this is. so annoying to test :P "yeah you can only test once each time you don't use your tumblr dashboard for a long enough time that the caught up element isn't on the first page of your dash." fun!
Description
This adds the specified preference. Specifically, when the carousel in question is below the bottom of the viewport when Scroll to Bottom is activated or is added to the page when Scroll to Bottom is currently active, Scroll to Bottom is deactivated and the page is scrolled to the carousel.
This means that if the carousel is already on the page (but not visible to the user) when the Scroll to Bottom button is pressed, scrolling will never stop. We could also add code that the Scroll to Bottom button, when pressed, checks for a carousel that is below the bottom of the viewport and jumps to it instead of activating if so. I think this would be the correct behavior, but is there a more elegant way to do this?Implemented.Note that I'm not sure if the carousel in question actually always appears, so this might be of limited utility.
Testing steps
Note some useful modifications for testing:
Stops at recommended blog/tag carousels too... which, admittedly, also vanish after a few refreshes, so this isn't always very useful.
Stops at random timeline elements.
With endless scrolling enabled:
With endless scrolling disabled: