Skip to content

A platform for community discussion. Free, open, simple.

DEV: Ensure sidebar sections are collapsable in mobile view (#31383)

Sérgio Saquetim0abc33c5a25a
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs b/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs
index 173cf21842b..10749c6a970 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs
@@ -33,13 +33,10 @@ export default class SidebarHamburgerDropdown extends Component {
}
get collapsableSections() {
- if (
- this.siteSettings.navigation_menu === "header dropdown" &&
- !this.args.collapsableSections
- ) {
- return this.site.mobileView || this.site.narrowDesktopView;
+ if (this.site.mobileView || this.site.narrowDesktopView) {
+ return true;
} else {
- this.args.collapsableSections;
+ return this.args.collapsableSections;
}
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
index d90b09d717a..59e9ec31ac9 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
@@ -77,6 +77,27 @@ acceptance(
}
);
+acceptance(
+ "Sidebar - Logged on user - Mobile view - Sidebar enabled",
+ function (needs) {
+ needs.user();
+ needs.mobileView();
+
+ needs.settings({
+ navigation_menu: "sidebar",
+ });
+
+ test("sections are collapsable", async function (assert) {
+ await visit("/");
+ await click("#toggle-hamburger-menu");
+
+ assert
+ .dom(".sidebar-section-header.sidebar-section-header-collapsable")
+ .exists("sections are collapsable");
+ });
+ }
+);
+
acceptance(
"Sidebar - Experimental sidebar and hamburger setting enabled - Sidebar enabled",
function (needs) {