-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Handle scrolling on Reddit redesign #3119
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
Conversation
This is more or less what I was going to try to get to. Reddit is sufficiently important to warrant a site-specific hack.
Yes. Please refactor to eliminate duplication. Perhaps with configuration via a dictionary mapping hostnames to CSS. No need to go so far as an external configuration file just yet. It's enough to have the code isolated from the real scrolling logic at the bottom of |
Thank you for the review @smblott-github, I'll make changes to implement your feedback. |
@smblott-github I took at stab at refactoring it and pushed a few changes. One thing that I'm not satisfied with is how I had to bust the value of I found some code around It seems to me that any scrolling state should be reset when history changes, so my thought was to refactor Another option is to create a checkIfEnabledForUrl = do ->
Frame.addEventListener "isEnabledForUrl", (response) ->
# ...
if normalMode
refreshModes()
else
installModes() That function would contain only |
Hi @smblott-github, thank you for merging this. |
1. Use verb phrase for function name. 2. Add `Scroller.reset()` method. This *only* resets the activated element. 3. Reset the scroller only if the URL has changed. (Previously, in philc#3119, the scroller was also being reset when the tab gained the focus.) Based on a suggestion from @marcotc.
Still facing this issue with j and k scrolling as of December 9, 2018. |
Confirmed regression, almost certain Reddit has changed their layout. |
Bump, also experiencing this issue. |
Doesn't work for me with Firefox 65.0.2 on Linux. Vimium version 1.64.3. |
Doesn't work on Chrome Version 73.0.3683.103 (Official Build) (64-bit) |
same here as well, using the 74.0.3729.108 build of chorme |
This PR adds support for scrolling the through the new Reddit post popups, introduced during the ongoing Reddit redesign effort.
Before scrolling with j and k would scroll the background, instead of the foreground article:
With the changes in this PR, it will now scroll the popup post correctly:
Implementation notes
Unfortunately
document.scrollingElement
will always return the document's body, meaning we never reach our fallback codes that could handle edge-cases like this.The solution implemented in this PR is ad-hoc, which is subpar to say the least. It is based on a recent similar fix for Twitter.
If this solution is acceptable for now, I'm willing to refactor these two ad-hoc to reduce code duplication.
I could move them into an external configuration file instead, as the only variables are the URLs affected, and how to find the scrollable element.