Slack – How to Turn Off Smooth Scrolling

slackuser interface

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?

Best Answer

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);