Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

back-end user menu closes accordions in view #44853

Closed
Ruud68 opened this issue Feb 11, 2025 · 6 comments
Closed

back-end user menu closes accordions in view #44853

Ruud68 opened this issue Feb 11, 2025 · 6 comments

Comments

@Ruud68
Copy link
Contributor

Ruud68 commented Feb 11, 2025

Steps to reproduce the issue

in a back-end view ./administrator/components/com_content/tmpl/articles/default.php create an accordion with the joomla core htmlhelpers, add the following lines before the line starting with <form action=

<?php echo HTMLHelper::_('bootstrap.startAccordion', 'accordion-test'); ?>
<?php echo HTMLHelper::_('bootstrap.addSlide', 'accordion-test', Text::_('TEST'), 'test-collapse', 'test'); ?>
   <h1>TEST-ACCORDION</h1>
<?php echo HTMLHelper::_('bootstrap.endSlide'); ?>
<?php echo HTMLHelper::_('bootstrap.endAccordion'); ?>

When you now go to the view articles, you see the closed accordion.
Click on the accordion to open it.
The accordion opens.

now click on the topbar menu 'User Menu'

The accordion now closes although it should stay open.

The issue here is that the template.js selects all elements with [data-bs-toggle="collapse"]

and the closes these.

This is not correct! it should only close dropdowns (used in the menus) and no other elements.

Expected result

accordion should stay open

Actual result

accordion (and if multiple set on the page, accordions) are closed

System information (as much as possible)

J5.2 (latest)

Additional comments

@richard67
Copy link
Member

Duplicate report to issue #44140 ? If yes, please test if this PR helps: #44221 . It will need to use the package created by Drone for testing, or if you have a development environment run npm ciafter applying the changes from the PR.

@Ruud68
Copy link
Contributor Author

Ruud68 commented Feb 11, 2025

hi @richard67 thanks for following up, appreciate it.
unfortunately this is not related. The PR you linked is for the front-end template, not the back-end (the metismenu.js it is not used in the back-end).
As pointed out, this is an issue in atum template.js

@richard67
Copy link
Member

As pointed out, this is an issue in atum template.js

@Ruud68 Ah, sorry, seems I did read too fast.

@brianteeman
Copy link
Contributor

The relevant js cane be found at

/**
* 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'));
if (target.contains(button)) {
return;
}
const collapseMenu = bootstrap.Collapse.getInstance(target) || new bootstrap.Collapse(target, {
toggle: false,
});
collapseMenu.hide();
});
});

@brianteeman
Copy link
Contributor

Please test #44858

@richard67
Copy link
Member

Closing as having a pull request. Please test #44858 . Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants