Anti-keyboard-scrolljacking userscript

Custom title
Staff
Developer
Joined
Jan 19, 2018
Messages
2,478
I am going to fix the scrolling issue on Chrome ASAP, but admittedly this would fix it for now in the sense that it returns default browser behaviour to the arrow keys.

This does mean that the keyboard scroll speed setting will cease to work with this script, but that's probably not relevant anyway if the scrolling is already broken.

I will say that I'm not understanding why you decided to disable scrolling with
Code:
w
and
Code:
s
as well since they're not used for default scrolling behaviour in browsers anyway.
 
Joined
Jan 18, 2018
Messages
8
That's awesome to hear. I assumed that it would be fixed at some point, so I really only threw it together so that I could use it temporarily.

As for why I did it for 'w' and 's' as well, It was hacked together in like <2 minutes, so I literally just copied & pasted the fall-through cases in the switch statement from reader.min.js :p:
Code:
                        document.addEventListener("keydown", function(r) {
                            // ... snip ...
                                    switch (r.key.toLowerCase()) {
                                    case "arrowup":
                                    case "up":
                                    case "w":
                                        return r.preventDefault(),
                                        // ... other code ...
                                    case "arrowdown":
                                    case "down":
                                    case "s":
                                        return r.preventDefault(),
                                        // ... other code ...
 
Joined
Jan 18, 2018
Messages
8
@Teasday I made a fix that is more... "proper"-ish... (The actually proper thing to do would be to update chrome, but meh.):
https://github.com/Andoryuuta/shim-old-scrollby

I'm not sure if this is the same scrolling issue that others are having, but I figured I would post the issue/solution just in case it helps. According to http://caniuse.com/#feat=css-scroll-behavior, on Chrome versions <61 (and the latest versions of IE, Edge, Safari, etc), the variation of
Code:
window.scrollBy
that takes an object argument with css scroll behaviors doesn't exist. A simple solution is to shim
Code:
window.scrollBy
, check the argument types, and forward the "top" and "left" arguments without the "behavior" to the normal
Code:
window.scrollBy(x,y)
, this obviously leaves out any smoothing though.
 

Users who are viewing this thread

Top