mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
Highlight menu group containing the active item
This commit is contained in:
parent
15385eeda5
commit
f864fc6e22
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -209,17 +209,19 @@ class SideNav {
|
||||
const dropdownMenu = link.closest('.dropdown-menu') as Nullable<HTMLDivElement>;
|
||||
if (isElement(dropdownMenu)) {
|
||||
// Find the closest `.nav-link`, which should be adjacent to the `.dropdown-menu` element.
|
||||
const groupItem = dropdownMenu.parentElement;
|
||||
const groupLink = dropdownMenu.parentElement?.querySelector('.nav-link');
|
||||
if (isElement(groupLink)) {
|
||||
groupLink.classList.add('active');
|
||||
if (isElement(groupLink) && isElement(groupItem)) {
|
||||
switch (action) {
|
||||
case 'expand':
|
||||
groupLink.setAttribute('aria-expanded', 'true');
|
||||
groupItem.classList.add('active');
|
||||
dropdownMenu.classList.add('show');
|
||||
link.classList.add('active');
|
||||
break;
|
||||
case 'collapse':
|
||||
groupLink.setAttribute('aria-expanded', 'false');
|
||||
groupItem.classList.remove('active');
|
||||
dropdownMenu.classList.remove('show');
|
||||
link.classList.remove('active');
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user