How to always show sidebar as menu panel?

On a community I’ve enabled the sidebar and adjusted the panel view like that:

I’d always like to use that panel menu and not switch between panel and sidebar depending on view-width. Is there a simple declaration to achieve that?

2 Likes

Right now, it is not easily configurable via SiteSetting.

Behavior is controller by NarrowDesktop

The potential solution would be to create a plugin which would overwrite isNarrowDesktopView function to always return true.

Something like initializers/always-narrow-view.js

import NarrowDesktop from "discourse/lib/narrow-desktop";

export default {
  name: "always-narrow-view",

  initialize(container) {
    NarrowDesktop.isNarrowDesktopView = () => true;
  }
}
3 Likes

Thank you Kris!! :sunny:

I wrapped it in a theme component and so far seems to work like a charm :sparkles:

Will play around and test it a bit more still…

2 Likes

So I love how this works for full-page layouts, offering a generous sidebar menu without breaking the layout:

Unfortunately I realized it also changes the user-menu to always slide-in. That’s not such a good experience. I guess it will get more complicated to de-couple the behavior?

As a side-note, I saw that the user menu panel has the classes:
.user-menu.revamped.menu-panel.slide-in
But the sidebar menu panel only has the classes:
.revamped.menu-panel.slide-in
I think it could be helpful to have a dedicated class .sidebar-menu there as well.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.