6

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?

3
+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);
  • 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? – Gilles Sep 27 '17 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 '17 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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