Skip to content

Commit

Permalink
[4.0] close collapse when opening a dropdown (joomla#43891)
Browse files Browse the repository at this point in the history
* make sure you click on the button, not any of the children

* close collapse when click to open a dropdown

* fix lint:js issues

* Update build/media_source/templates/administrator/atum/js/template.es6.js

Co-authored-by: Brian Teeman <brian@teeman.net>

---------

Co-authored-by: Brian Teeman <brian@teeman.net>
  • Loading branch information
2 people authored and dgrammatiko committed Aug 11, 2024
1 parent b9aefe4 commit 6fd3e37
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions build/media_source/templates/administrator/atum/js/template.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,20 @@ window.addEventListener('joomla:menu-toggle', (event) => {
changeLogo(event.detail);
}
});

/**
* Close any open data-bs-toggle="collapse" when opening a data-bs-toggle="dropdown"
*
* @since 4.4
*/
document.querySelectorAll('[data-bs-toggle="dropdown"]').forEach((button) => {
button.addEventListener('click', () => {
document.querySelectorAll('[data-bs-toggle="collapse"]').forEach((cb) => {
const target = document.querySelector(cb.getAttribute('data-bs-target'));
const collapseMenu = bootstrap.Collapse.getInstance(target) || new bootstrap.Collapse(target, {
toggle: false,
});
collapseMenu.hide();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@
.fas {
font-size: 1.5rem;
}

> * {
pointer-events: none;
}
}

.container-search {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
&.btn {
padding-inline-end: 0;
}

> * {
pointer-events: none;
}
}

.btn-group:not(:last-child) > .dropdown-toggle-split {
Expand Down

0 comments on commit 6fd3e37

Please sign in to comment.