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.
It seems now if there is an incomplete / empty tab, the module breaks all the JS on the site.
I could not debug perfectly, but maybe this was the problematic part:
<div id="tabs-tabset" class="drupal-tabs js-hide"><div class="description"></div><ul class="clear-block"></ul></div> </div>
I added a try-catch block to make it more robust. It's not an elegant solution, maybe you have a better idea to fix this inside the .module function. But at least it makes the JS code secure in that way that it does not break other JS at the site.
Comment | File | Size | Author |
---|---|---|---|
#5 | 813800_tabs_js_empty_tabs.patch | 1.4 KB | Aron Novak |
tabs_better_js.patch | 2.42 KB | Aron Novak |
Comments
Comment #1
Aron NovakComment #2
opteronmx CreditAttribution: opteronmx commentedChanging title to be more descriptive.
-------
Issue confirmed.
I have the same issue on a node type with fieldgroups rendered as tabs. When all the fields inside the fieldgroups are empty, all the javascript on my site stops working.
Also, when I change from a browser's tab to another, I get the follow JS error on firebug:
"F is undefined"
On jquery_update.module's replacement file (jquery.min.js) for default drupal's jquery one. Or:
"elem is undefined"
on line
var id = elem[ expando ];
in the non-minimized jquery.js file.
The patch works, but I think that there must not be even an output on this conditions (all fields and all tabs empty). I've tried to fix it on tabs.module, but I didn't find what to validate as !empty().
Comment #3
nedjoYeah, I think this needs to be done on the PHP side.
Comment #4
mogop CreditAttribution: mogop commentedHad the same problem before.
I applied your patch but still can't load tabs even when they are not empty. maybe there is conflict with jquery_ui?
Comment #5
Aron NovakNow it's settled from the theme function, it simply does not print out code when there are not tabs.
Comment #6
Aron NovakAny interest on this one? I think this fix is quite clean, isn't it?
Comment #7
mogop CreditAttribution: mogop commentedI didn't try yet, sorry
Comment #8
HansKuiters CreditAttribution: HansKuiters commentedTried patch #5: it works. Thanks.
Comment #9
Patrizio CreditAttribution: Patrizio commented+1 for patch #5