Hi, the template for a collapsible panel titles looks like this:

 <a href="#" class="panel-title fieldset-legend" data-toggle="collapse" data-target="<?php print $target; ?>"><?php print $title; ?></a>

The href="#" causes really annoying behaviour with JS disabled/loading/broken, with the page jumping to the top of the screen on every click. The bootstrap markup examples look like this:

<a class="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Link with href
</a>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LewisNyman created an issue. See original summary.

LewisNyman’s picture

The attached patch only links directly to the wrapper, as that is where the ID is coming from. It looks like we could move the id from the wrapper to the collapsible container to match the bootstrap examples but I don't know if that would cause side effects...

LewisNyman’s picture

Status: Active » Needs review
markhalliwell’s picture

Status: Needs review » Needs work
+++ b/templates/bootstrap/bootstrap-panel.tpl.php
@@ -12,7 +12,7 @@
+      <a href="#<?php print $id ?>" class="panel-title fieldset-legend" data-toggle="collapse" data-target="<?php print $target; ?>"><?php print $title; ?></a>

Can't seem to find the related issue for this, but the same type of fix in the 8.x-3.x branch. Essentially, the href should be using the $target variable and data-target should just be entirely removed. When that data attribute is provided, Bootstrap doesn't prevent the default behavior, which is why these JS lines were added and can likely be removed as well.

markhalliwell’s picture

Not the issue I was thinking of, but similar nonetheless.

markhalliwell’s picture

Status: Needs work » Fixed
FileSize
1.74 KB

  • markcarver committed c06ce55 on 7.x-3.x
    Issue #2729181 by markcarver, LewisNyman: Collapsible panel titles link...
glynster’s picture

Hi @markcarver we just had to revert back to bootstrap 7.x-3.16 as all collapse panels were open by default and caused any content inside to appear blank. Any vertical tabs say in the appearance theme were broken as well.

https://cl.ly/112s2l3T3g0W

Out of the patches this seems to be the one where js was updated.

markhalliwell’s picture

@glynster, you need to change your sub-theme's CSS, see #2634358-17: Multiple collapsible fieldsets have broken triggers in BS3.3.4.

I suppose I should create a change record for this.

markhalliwell’s picture

@glynster, change record is here: https://www.drupal.org/node/2938332

glynster’s picture

@markcarver and this is why you are a rockstar at what you do and for the community - super fast and you know exactly where to go! Resolved. Tnx a million!

markhalliwell’s picture

:D it's always great to hear that

markdc’s picture

@markcarver Thanks for directing to the change record. It's a good reminder to replace those subtheme files after updates.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.