Skip to content

fix(WEB-BUG-011): fix sidebar Organizations menu not expanding#70

Merged
MZC-CSC merged 3 commits into
m-cmp:mainfrom
MZC-CSC:develop
Apr 30, 2026
Merged

fix(WEB-BUG-011): fix sidebar Organizations menu not expanding#70
MZC-CSC merged 3 commits into
m-cmp:mainfrom
MZC-CSC:develop

Conversation

@dogfootman
Copy link
Copy Markdown
Member

Summary

Fix two bugs that prevented the Organizations sidebar menu from expanding when clicked.

  • Fix incorrect menu.menus === null null check in generateMenuHTML() (sidebar.js)
  • Remove data-bs-toggle="dropdown" attribute that caused Bootstrap and custom handlers to conflict

Root Cause

Bug 1 — Wrong null check
convertToMenuTree() initializes every menu node with menus: [] (empty array), so the condition menu.menus === null was always false. Leaf menu items (with no children) were incorrectly rendered as dropdown toggles instead of plain nav links.

Bug 2 — Bootstrap double-toggle
The dropdown-toggle <div> had data-bs-toggle="dropdown", which made Bootstrap's built-in click handler fire alongside the custom nextElementSibling toggle handler. Both handlers toggled the show class, resulting in the menu opening and immediately closing (net: no visible change).

Changes

  • front/assets/js/partials/layout/sidebar.js
    • menu.menus === null!menu.menus || menu.menus.length === 0
    • Removed data-bs-toggle="dropdown" data-bs-auto-close="false" from generated dropdown HTML

Verification

  • Login and click Organizations in the left sidebar — submenus now expand correctly
  • Leaf menu items (no children) render as plain <a> nav links
  • All other expandable menus behave normally

Issue Reference

  • WEB-BUG-011 (internal bug tracker)

yh-noh and others added 3 commits April 29, 2026 08:32
Two bugs prevented the dropdown menu from opening:

1. `menu.menus === null` condition in generateMenuHTML() was always
   false because convertToMenuTree() initializes every node with
   `menus: []`. Changed to `!menu.menus || menu.menus.length === 0`
   so leaf items render as plain nav links, not dropdown toggles.

2. `data-bs-toggle="dropdown"` on the dropdown-toggle div caused
   Bootstrap's built-in handler and the custom click handler to both
   toggle the `show` class, netting to no change (open then close).
   Removed the Bootstrap attribute; the custom handler already manages
   show/hide manually via nextElementSibling.
fix(WEB-BUG-011): fix sidebar Organizations menu not expanding
@MZC-CSC MZC-CSC merged commit ab6bf0a into m-cmp:main Apr 30, 2026
3 checks passed
MZC-CSC added a commit that referenced this pull request May 11, 2026
fix(WEB-BUG-011): fix sidebar Organizations menu not expanding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants