Slack: collapse all sidebar sections
Collapses every expanded section in the channel sidebar with one click for a short, tidy list.
Code to copy
// Collapse every expanded section in the channel sidebar at once
const headings = document.querySelectorAll('.p-channel_sidebar__section_heading[aria-expanded="true"]');
let n = 0;
headings.forEach(function (h) {
const btn = h.querySelector('.p-channel_sidebar__section_heading_button') || h;
btn.click();
n++;
});
console.log('[Slack] collapsed ' + n + ' sidebar sections');
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Enable the action panel, add a button in the Actions tab and paste the code into it — run it with one click.
Rate this example
No ratings yet — be the first.