not sure if this should be marked critical, but since it prevent the average joe from accessing all settings during the install, I figured it's quite a biggie

the problem is that the #attached_js doesn't get added untill theme_fieldset, where it doesn't really get used, so I moved this:

$element['#attached_js']['misc/collapse.js'] = array();

from the theme_fieldset function to the form_process_fieldset(&$element, &$form_state) function (where form.js also gets added), wrapped in the conditional

requires review with edge cases

Comments

seutje’s picture

Title: Collapsible fieldsets don't work on install.php pages » Collapsible fieldsets don't work when using garland (which install.php still uses)
seutje’s picture

Status: Active » Needs review
TheRec’s picture

StatusFileSize
new864 bytes

It works. The collapsible fieldset "Advanced options" works during install with Garland and other collapsible fieldsets are also working when using Garland as the administration theme.
I re-rolled this just to have the correct line-endings (nothing else changed), I thought it would spare you the monkey job ;)

Which other "edge" cases do you think we should test ?

seutje’s picture

dammit, always forget about the CRs :x

for the other edge-cases: I dunno, some people do some serious magic with their forms

bowersox’s picture

The patch works for me too. "Advanced options" are back during install. In addition you can now find working collapsible fieldsets here:

  • Appearance /admin/appearance
  • Block settings /admin/structure/block/configure/system/navigation
  • Advanced search /search/node

Thanks for the fix! This looks ready for RTBC.

davyvdb’s picture

Status: Needs review » Reviewed & tested by the community
davyvdb’s picture

I had come to the same solution for this.

alanburke’s picture

Patch applies cleanly and does the job.

Is there any way to add tests for this kind of stuff?
It's easy enough to change some markup, ids, classes etc, and forget that some javascript functionality is relying on it.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oh, yay! Thanks a lot for this, it's been seriously annoying me. :)

Committed to HEAD!

bowersox’s picture

Should the same drupal_add_js() call be removed from seven/template.php:

  /**
   * Override of theme_fieldset().
   *
   * Add span to legend tag, so we can style it to be inside the fieldset.
   */
  function seven_fieldset($element) {
    if (!empty($element['#collapsible'])) {
-    drupal_add_js('misc/collapse.js');

      if (!isset($element['#attributes']['class'])) {
        $element['#attributes']['class'] = array();
      }
davyvdb’s picture

Status: Fixed » Needs review
StatusFileSize
new3.24 KB

Yes, and even more. We can remove the whole

  if (!empty($element['#collapsible'])) {

    if (!isset($element['#attributes']['class'])) {
      $element['#attributes']['class'] = array();
    }

    $element['#attributes']['class'][] = 'collapsible';
    if (!empty($element['#collapsed'])) {
      $element['#attributes']['class'][] = 'collapsed';
    }
  }
  $element['#attributes']['id'] = $element['#id'];

Because adding the javascript without the classes makes no sense.

seutje’s picture

Title: Collapsible fieldsets don't work when using garland (which install.php still uses) » move collapsible fieldset logic from theme_fieldset hook to form_process_fieldset

this title better?

bowersox’s picture

StatusFileSize
new3.24 KB

Here's a revised patch with one important line of code retained in form_process_fieldset() that the last patch had removed:

$element['#attached_js']['misc/collapse.js'] = array();

I believe we need to keep that line of code to keep the collapsible fieldsets working. @Davy, tell me if I'm misunderstanding or if a different change is needed.

davyvdb’s picture

@brandonojc correct. copy past error :)

Status: Needs review » Needs work

The last submitted patch failed testing.

seutje’s picture

StatusFileSize
new2.91 KB

updated to current HEAD (crossing fingers)

seutje’s picture

Status: Needs work » Needs review

go testbot!

seutje’s picture

omg, first try, I think I'm going to cry

bowersox’s picture

+1 for the patch in 16 from seutje. The code looks good and we reduce duplication without changing functionality. I tested and found that everything works right:

  • Install.php 'Advanced options' collapsed fieldset still works
  • Appearance /admin/appearance fieldset works and starts out collapsed (the class and id attributes are still correct too)
  • Block settings /admin/structure/block/configure/system/navigation still works the same, with one fieldstart open by default and the others collapsed
  • Advanced search /search
  • Seven, Garland, and Stark themes
  • And this plays nice with #541568: Link to expand / collapse fieldsets has poorly accessible link text

Status: Needs review » Needs work

The last submitted patch failed testing.

bowersox’s picture

Status: Needs work » Needs review
StatusFileSize
new3.22 KB

Please review. This is just a re-roll of the prior patch. In brief, this change reduces duplicate code without changing functionality.

Tests passed:

  • Confirmed the collapsible fieldsets still work in Garland and Seven (eg /search and /admin/appearance)
  • Verified in Firefox 3.5 and Safari 4 on Mac

Status: Needs review » Needs work

The last submitted patch failed testing.

mattyoung’s picture

.

bowersox’s picture

Status: Needs work » Needs review
StatusFileSize
new3.22 KB

Please review this one instead ;-) Sorry about that last one--dumb mistake trying to fix a blank line.

bowersox’s picture

Can anyone give a quick review and test of this?

seutje’s picture

Status: Needs review » Reviewed & tested by the community

looks good afaict

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Hm. I think this makes sense. Makes the theme function a heck of a lot cleaner, anyway. I was originally concerned about that misc/collapse.js might be better as a theme-only thing, but we're already setting that and attach.js in the process function.

Committed to HEAD.

Status: Fixed » Closed (fixed)

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

mikehughes’s picture

Version: 7.x-dev » 7.2
Priority: Critical » Normal
Status: Closed (fixed) » Needs work

this might have been fixed for most browsers but it is still an issue for Chrome users. The Advanced Options just won't show, don't even show as a hyperlink. This was using the latest stable download for 7.2 on Chrome 12.0.742.91

summit’s picture

Still not working on Chrome for version 7.19!
Greetings, Martijn

LadyAnna’s picture

Issue summary: View changes

Still doesn't work on chrome with version 7.36, worked when I switched to firefox though.

  • webchick committed d4d43f1 on 8.3.x
    #560944 by seutje: Fixed collapsible fieldsets in Garland.
    
    
  • webchick committed 3e8344b on 8.3.x
    #560944 follow-up by brandonojc, seutje, and Davy Van Den Bremt: Move...

  • webchick committed d4d43f1 on 8.3.x
    #560944 by seutje: Fixed collapsible fieldsets in Garland.
    
    
  • webchick committed 3e8344b on 8.3.x
    #560944 follow-up by brandonojc, seutje, and Davy Van Den Bremt: Move...

  • webchick committed d4d43f1 on 8.4.x
    #560944 by seutje: Fixed collapsible fieldsets in Garland.
    
    
  • webchick committed 3e8344b on 8.4.x
    #560944 follow-up by brandonojc, seutje, and Davy Van Den Bremt: Move...

  • webchick committed d4d43f1 on 8.4.x
    #560944 by seutje: Fixed collapsible fieldsets in Garland.
    
    
  • webchick committed 3e8344b on 8.4.x
    #560944 follow-up by brandonojc, seutje, and Davy Van Den Bremt: Move...

  • webchick committed d4d43f1 on 9.1.x
    #560944 by seutje: Fixed collapsible fieldsets in Garland.
    
    
  • webchick committed 3e8344b on 9.1.x
    #560944 follow-up by brandonojc, seutje, and Davy Van Den Bremt: Move...

Version: 7.2 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.