No Code Attached Yet
avatar jreviews
jreviews
25 Sep 2021

Steps to reproduce the issue

Create an accordion:

<?php echo HTMLHelper::_('bootstrap.startAccordion', 'group', [
	'parent' => 'group',
	'active' => 'slide-1',
]); ?>

<?php echo HTMLHelper::_('bootstrap.addSlide', 'group', 'Title A', 'slide-1'); ?>
Content A
<?php echo HTMLHelper::_('bootstrap.endSlide'); ?>

<?php echo HTMLHelper::_('bootstrap.addSlide', 'group', 'Title B', 'slide-2'); ?>
Content B
<?php echo HTMLHelper::_('bootstrap.endSlide'); ?>

<?php echo HTMLHelper::_('bootstrap.endAccordion'); ?>

Expected result

The first slide should be active and expanded on page load

Actual result

All slides are collapsed

System information (as much as possible)

Issue comes from media/vendor/bootstrap/js/collapse.js where all accordions are forced to collapse.

image

Additional comments

In addition to this, the aria-expanded attribute in accordions is always empty.

$ariaExpanded = $in === 'show' ? true : false;

Should be:

$ariaExpanded = trim($in) === 'show' ? 'true' : 'false';
avatar jreviews jreviews - open - 25 Sep 2021
avatar joomla-cms-bot joomla-cms-bot - change - 25 Sep 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Sep 2021
avatar jreviews jreviews - change - 25 Sep 2021
The description was changed
avatar jreviews jreviews - edited - 25 Sep 2021
avatar jreviews jreviews - change - 25 Sep 2021
Title
Accordions are always collapsed
[4.0] Accordions are always collapsed
avatar jreviews jreviews - edited - 25 Sep 2021
avatar jreviews jreviews - change - 25 Sep 2021
Title
[4.0] Accordions are always collapsed
[4.0] Accordions always collapsed by default
avatar jreviews jreviews - edited - 25 Sep 2021
avatar brianteeman
brianteeman - comment - 29 Sep 2021

You don't need 'parent' => 'group', in the array

I can not confirm your issue with aria-expanded

collapse

avatar jreviews
jreviews - comment - 29 Sep 2021

You are right, without using the parent option, the active slide works, but also the accordion doesn't automatically collapse a slide when another one is opened, so you end up with all slides open as you click them. My understanding is that this is why you would use the parent option to begin with.

Check the code in the file I referenced.

		$in        = static::$loaded[__CLASS__ . '::startAccordion'][$selector]['active'] === $id ? ' show' : '';

$in is set to ' show', with an extra leading space. Then after that you have a strict check that will never be true:

$ariaExpanded = $in === 'show' ? true : false; 

And finally, since the values are set to boolean instead of strings, they output on the page will either be one or zero within the attribute.

For this last bit you may need to check the source of the page using view-source: in the address bar, rather than looking at the page after it's been loaded and javascript initialized.

avatar brianteeman
brianteeman - comment - 4 Nov 2021

I cannot confirm your comments regarding the $ariaexpanded. That is working perfectly as intended.

avatar jreviews jreviews - change - 5 Nov 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-11-05 13:59:41
Closed_By jreviews
avatar jreviews jreviews - close - 5 Nov 2021

Add a Comment

Login with GitHub to post a comment