9

In Slack, when I'm browsing a channel, if I press PageUp/PageDown, the channel content scrolls smoothly, i.e. the content moves one screen line at a time and it takes about one second to perform the operation. Strangely, I only have this problem with PageUp/PageDown: other methods of scrolling, such as Up/Down, the mouse wheel or clicking on the scroll bar to scroll by one page at a time work instantly.

I have smooth scrolling disabled in my browser. I tried with both Firefox and Chrome.

I presume this will take some custom Javascript but I haven't found an existing userscript and I can't figure out what's causing the smooth scrolling.

How do I turn off Slack's smooth scrolling?

1 Answer 1

4
+100

This userscript kills the smooth scrolling. I tested it with Violentmonkey in Chrome.

// ==UserScript==
// @name        Slack: disable smooth scrolling on PgUp/PgDown/Home/End
// @namespace   slack_disable_smooth_scrolling
// @description Disables the smooth scrolling
// 
// @match       https://*.slack.com/*
// @version     1.0.0
// @grant       none
// @run-at      document-start
// ==/UserScript==

document.addEventListener("keydown", function(ev) {
    if(ev.key == "PageDown" || ev.key == "PageUp" || ev.key == "Home" || ev.key == "End") {
        if(ev.target && ev.target.classList && ev.target.classList.contains("ql-editor")) {
            document.getElementById("msgs_scroller_div").focus();
        }
        ev.stopImmediatePropagation();
    }
}, true);
2
  • This works in Firefox with Tampermonkey, thank you! However, not being able to use PgUp/PgDn while the focus is on the input box is annoying. Is there a more convenient way to switch to the message section than Ctrl+` followed by Tab, which is pretty awkward and unmemorable? Sep 27, 2017 at 17:09
  • @Gilles Fixed to allow scrolling while in the input box (tested Violentmonkey in Chrome again), let me know if it doesn't work or breaks some other functionality.
    – Ivan Kozik
    Sep 27, 2017 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.