Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After diving into the related issues, it's apparent that we need to wrap core's misc/collapse.js
so modules that utilize it's API can trigger the Bootstrap collapse plugin instead.
Comment | File | Size | Author |
---|---|---|---|
#26 | 2224211-26-collapsible-fieldset.patch | 681 bytes | justindodge |
#24 | 2224211-collasible-fieldset-remove-class.patch | 431 bytes | theo_ |
#23 | collasible-fieldset-remove-class.patch | 431 bytes | MauPalantir |
Comments
Comment #2
markhalliwellComment #5
steveixa CreditAttribution: steveixa commentedI'm using Bootstrap theme and am finding that my collapsible fieldsets aren't working. I click on them but they just stay as they are. Is there a workaround short of upgrading my theme to the dev version?
thanks
Comment #6
steveixa CreditAttribution: steveixa commentedI'm experiencing this problem in Drupal 7. I tried upgrading to the dev version of the theme but it broke my site. How can I apply the fix for this problem.
thanks
Comment #7
steveixa CreditAttribution: steveixa commentedbump
Comment #8
markhalliwellIt was fixed in 7.x-3.x-dev (subsequently there's now a 7.x-3.1-beta1 release). View the release notes so you can upgrade.
Comment #9
steveixa CreditAttribution: steveixa commentedok - thanks for replying.
I did try that but it really messed up my site. Also, it didn't fix the issue with Collapsible fieldsets not expanding and collapsing.
any workarounds?
thanks
Comment #11
markhalliwellI'm just moving this back to 7.x. If this needs re-evaluation in 8.x, create a new issue.
Comment #12
iaminawe CreditAttribution: iaminawe commentedUsing 7.x-3.1-beta1 and manually applying the updates from #10 I still find that drupals collapsible fieldsets are not working properly.
I tried to update to beta2 but so much broke that I needed to roll back and try just fix this component.
Here is the markup being output - clicking on the expand/collapse header does nothing. Does this look correct to you?
Then I thought I should try with the latest 3.x dev of Bootstrap in a fresh local install of Drupal - I set this up and made a simple collapsed group on a node
It worked the first time I clicked the title and it opened the collapsed container and then closed when I clicked again and then would not reopen again.
I was able to replicate this a few times where only the first open and close works and then it stops responding.
Any thoughts?
Comment #13
markhalliwellThis is because the grid stuff was actually reverted (#2128129-19: Provide setting to change sidebar/content widths). It sounds like you're one of the very few people who used dev/beta for prod (which is never recommended btw, for this very reason). I can tell you with fair amount of certainty that beta2 will not break on upgrade from 7.x-3.0 (like beta1 did). It does, however, break upgrading from beta1 (which is what sounds like your issue is). I would strongly recommend fixing your sub-theme to work with beta2 as this is the path we'll be moving forward with for the next release. I know this isn't ideal, but I would much rather face the wrath of a hundred people than 30k ;)
Are you manually injecting this HTML? Or is this generated in PHP somewhere? If that is the case, can you provide the PHP snippet so I can attempt to reproduce?
Comment #14
iaminawe CreditAttribution: iaminawe commentedThanks for the response Mark and great work with this theme.
This site has actually been in development (so is not prod yet) and I think the only reason I updated it to beta1 was to be able to generate the sub theme with drush - didn't realize the pain it may cause as its been solid to work with up until this point.
On the fresh install, I simply added a group to the display settings of the article content type and put a few fields inside of it.
I then added some test content and when viewing the node I was able to open and close the fieldset once before it stopped responding.
I did try to fix/update my sub theme to work with beta2 but it felt like it was too quickly becoming a rabbit hole of broken things.
All the region templates seem to have been removed in Beta2 and the page variables I was loading into the regions were broken and I was told in a warning that the $page variable no longer exists for the region templates - I did some troubleshooting but was not able to figure out what had changed to break that.
So to fix my sub theme to work with beta2 - I should attempt this patch? https://www.drupal.org/comment/9009607#comment-9009607
Would downgrading to 3.0 stable be a better course to take?
Comment #15
markhalliwellYes. That being said, the similarities between 3.0 and beta2 (as far as page.tpl.php and regions go) are very similar. You will undoubtedly run into quite a few bugs though on 3.0 (it's old). So I would recommend going with beta2 for now as we're very close to a stable release at this point.
The only reason we haven't made a release was because of that grid issue (breaking straightforward upgradability from 3.0). Normally, beta's should break like this and in reality (and in hindsight) they should probably be alphas. We live, we make mistakes, we move on :)
Anyway, now that the grid stuff has been reverted, I suspect you'll simply have to remove (rename/backup) your sub-theme's page and region templates. Then, just let the base-theme templates take over (things will obviously be broken if you had them overridden). Once you're at a starting point you can slowly copy in the old template changes (keeping in mind that all the region stuff will likely be back in the page template). So in the end, you'll likely have just one page template override and no region template overrides (because we really didn't use regions in 3.0).
I wouldn't. That was just to record the changes that I took out, so we have a starting point and can refactor. As stated in that issue, I was never really happy with that implementation (which should have been a sign that I shouldn't have committed it). So until we can come up with a better implementation that doesn't break everything, I would just hold off.
Now, regarding this issue. Did you see my question above:
Comment #16
iaminawe CreditAttribution: iaminawe commentedThanks for the clarifications Mark, that certainly helps me with getting my sub theme upgraded. I am going to attempt this again shortly.
That markup was , I believe, copied and pasted from the node display where the fieldset was defined on the "Manage Display" page so there was no manual injection or php snippet - just the normal node display.
I will report back here after the subtheme upgrade whether the fieldset collapsing still is or isn't working
Comment #17
iaminawe CreditAttribution: iaminawe commentedFollowing your instructions, I was able to upgrade my subtheme correctly.
At first the fieldsets behaved exactly the same and opened and closed once fine before locking up.
I checked the jquery update setting and it was still at 1.7 - after updating the version to 1.9 the fieldsets opened and closed correctly again.
Thanks for you help with this issue and my upgrade - sorry that it ended up being something silly on my side.
Comment #18
markhalliwellAh :) Yep, that'll do it! Cool, glad this got resolved relatively easily!
Comment #19
oriol_e9gI'm am using Bootstrap-3.1-beta2 with webform module and collapsible fields only works one time.
When the HTML is rendered appears like:
When I click to the collapsible fieldset works fine and it's collapsed:
When I click again to open the fieldset works and the HTML is converted as:
See that the 'collapse' class has disappeared, so at this point you cannot collapse again the fieldset. The fieldset works but only the first time you collapse-open the fieldset.
Comment #20
Plazik CreditAttribution: Plazik commentedUpdate Bootstrap css and js to 3.2.0 version.
Comment #21
markhalliwellComment #22
oriol_e9g@Plazik Yes! I can confirm that using Bootstrap 3.2 css/js it's working fine.
Comment #23
MauPalantir CreditAttribution: MauPalantir commentedIts not working for me, because after I close and open once again, i can't close.
i figured out that somehow the 'in' class is not removed properly. I made a patch that fixes it, though I dont know it is the best place to remove the class.
Comment #24
theo_ CreditAttribution: theo_ commentedSame issue here as mentionned by @Mau Palantír
Using:
Re-rolled patch to apply on last 7.x-3.x-dev version
Comment #25
markhalliwellSee #17 and verify your jQuery version is set properly. Bootstrap should remove the "in" class automatically in it's own JS, these patches shouldn't be necessary.
Comment #26
justindodge CreditAttribution: justindodge commentedI'm using jQuery 1.9 and the latest 7.x-3.x dev of bootstrap module.
I've tried bootstrap library 3.2.0 and the latest 3.3.4 and I'm getting the behavior described in #19 and #23 where the fieldset will expand one time, but subsequent clicks do nothing.
I also gave the patch in #24 a shot but it did not resolve the issue for me.
Maybe there has been a regression? Can anyone else reproduce?
I took a closer look and it seems like the problem is the data target looks
for #theelementid > .collapse
, but.collapse
seems to be the class that bootstrap uses to hide the collapsible content (it's display:none), and the class gets removed in the process of toggling, so it can't work again after you've expanded it once.I wrote a patch which changes
.collapse
to.panel-collapse
as the target, and it's working great for me now.Comment #27
markhalliwellPlease, stop re-opening closed issues (especially ones that have already been fixed, #10). Open a new one and reference other issues via the related issue field.
For the record, no, I cannot reproduce this with the latest dev code and Bootstrap 3.3.4.
Also, this project is not a module, it is a base-theme.
Comment #28
justindodge CreditAttribution: justindodge commentedWell it seemed like this was a continuance of the same issue, had relevant background in comment history, and potentially was not never fixed because I was not able to reproduce any circumstances where it ever worked given the previous suggestions.
To me, it seemed like a possibility that perhaps the collapsible fieldsets only seemed like they were working because because testers may have clicked on them once, saw activity, and assumed success - or something like that. Sometimes things are preemptively closed when folks stop following up. Perhaps I needed to read the history more thoroughly.
I've never posted on any issue with the bootstrap project before so I don't think I need to be told to stop re-opening things... I've tried to provide a rationale for this and it seems issues sometimes go from 'fixed' to 'active' for reasons like this, but everyone has their own way.
Anyway, apologies for the mix up and I will open a new one and see if we can get to the bottom of it.
Comment #29
justindodge CreditAttribution: justindodge commentedNo new issue after all - after some head scratching, it turns out I was simply looking at the base theme's settings for the Bootrap JS/CSS version by accident when I was actually using a sub-theme which apparently defaults to 3.0.2.
So the data target thing was a total red herring...and I was so sure there was a problem. Anyway...
Sorry about the chatter, carry on.
Comment #30
Bruno Vincent CreditAttribution: Bruno Vincent commentedI'm very much confused about this whole thread...
I'm using the latest version of Drupal 7.38 with latest
http://ftp.drupal.org/files/projects/bootstrap-7.x-3.0.zip
Now July 7 2015
Can somebody point out the DEFINITE solution to this?
Some many thread answers...
What will actually work?
Thanks
Comment #31
markhalliwell@Bruno Vincent, 7.x-3.0 will always be broken (nothing anyone can really do about that, unless you want to try and piece together the many issues that fixed it and patch it yourself). Instead, I recommend upgrading to 7.x-3.1-beta2 (where this has "definitely" been fixed).
Comment #32
BigEd CreditAttribution: BigEd commented@Bruno Vincent
To fix this issue just make sure you are using at least 7.x-3.1-beta2.
Go to yoursite.com/admin/appearance/settings/bootstrap
On the advanced tab set the version to 3.4
As a good measure do the same on your subtheme settings.
Now they will work
Comment #33
chup CreditAttribution: chup commented@BigEd
Sorry, but you posted a strange comment.
On mid of September 2015 there is no 3.4 version of Bootstrap (last one is 3.3.5). So, we definetly can't use 3.4 on the CDN settings of theme.
And 7.x-3.1-beta3 still not fixed this issue. The fieldsets became even worse: supposed to be collapsed by default here shows like opened and don't reacting to click at all. So we're still there :(
Comment #34
chup CreditAttribution: chup commentedThe problem in my case was with fieldsets provided by Field Group module. Despite on settings, panel was always open without possibility to click on it. I made some quick research and fixed it.
For case of Field Group fieldsets problem is in the bootstrap_preprocess_bootstrap_panel():
This code just overlapping real collapsible state and all further logic just not runs. So adding it up again in our theme.
Quick fix for broken collapsible fieldset (bootstrap-7.x-3.1-beta3)
Just add the following code to template.php of your Bootstrap subtheme:
Comment #35
arthur_drupal CreditAttribution: arthur_drupal as a volunteer commentedFor me, i have to add this in order collapsible fieldset work with bootstrap :
Moreover, remove Drupal default collapsible javascript
Comment #36
orcode CreditAttribution: orcode commentedI found that simply setting the Bootstrap SubTheme Bootstrap version to 3.3.5 seems to solve the collapsible fieldset issue - without additional modifications to template.php. I'm using Bootstrap-7.x-3.1-beta3 as a base.
Comment #37
knalstaaf CreditAttribution: knalstaaf commentedIf none of the above does the job there's still the manual approach:
(Tested on Bootstrap-7.x-3.1-beta3 / Bootstrap 3.3.5 - source)
Edit: this method will collapse the item(s) again after a reload of the page, which may not be desirable. I could pull it off with the Collapsiblock module instead.
Comment #38
aDarkling CreditAttribution: aDarkling as a volunteer commentedBootstrap 7.x-3.4 with Bootstrap 3.3.5
Problem still exists. The fix in #34 worked for me!
Comment #39
Andru CreditAttribution: Andru as a volunteer commentedBootstrap 7.x-3.4 with Bootstrap 3.3.5, Drupal 7.41, Jquery set to 1.7 then also tried 1.10 - same problem. I noticed that the anchor tags used to toggle the collapsibles are not being output as anchors, just spans. Also noticed that the 3.4 version says it wants Jquery 2.1, but Jquery Update does not offer that version yet.
None of the fixes on this page worked for me.
Comment #40
g089h515r806 CreditAttribution: g089h515r806 commentedI have the same issue. #34 does not work.
Comment #41
g089h515r806 CreditAttribution: g089h515r806 commentedIt is a bug of jquery update module for my case.
https://www.drupal.org/node/2695079#comment-11046745.
Apply this patch fix my issue.
Comment #42
kopeboy CreditAttribution: kopeboy commented@arthur_drupal
Where to put this?
@g089h515r806
That didn't fix for me. Maybe you did both that and this #34 patch?!
How is this Closed (fixed)?!
I am using bootstrap 7.x-3.5 with jsDelivered bootstrap 3.3.5 (also tried 3.3.6 with no luck), jQuery update to 1.10 and Alternate = Default (provided by Drupal)
See #2755911: Fieldsets in forms not rendered in bootstrap theme if you want to keep this closed..
Comment #43
dozer55 CreditAttribution: dozer55 as a volunteer commentedI have a project where I just discovered this was an issue. After trying several of the aforementioned solutions, I was unsuccessful. For now, I am doing this:
The "question" class that I am targeting comes from the type of view I've built, a "Question" and "Answer" view that the user can toggle the answer on and off. You can edit your code as needed. It's maybe not the cleanest solution, but it works for me!
Comment #44
kopeboy CreditAttribution: kopeboy commentedGuys, just to be clear, what is the result of this problem:
Cause I am having the second problem, and I am surprised such few people are reporting this..
Example:
Commerce Checkout don't get output at all!
Just switch theme and you see everything as normal..
Comment #45
markhalliwellThis issue has become a "catch all" for anything semi-related to fieldsets and #collapsible.
Closing the issue. If you feel something is related, please don't re-open a long closed issue.
Instead, use the "Related issues" field and reference the closed one. That is what it is there for.
Comment #46
m.stenta