I'm working on a Drupal 7 project where I use the form API to build a form. I want my form's fieldsets to be collapsed by default.
I use the following code:
$form['fieldset'] = array( '#type' => 'fieldset', '#title' => t('categories group'), '#collapsible' => TRUE, '#collapsed' => TRUE, );
When refreshing the page the fieldset is not collapsed although it has the collapsed class. When clicking on the fieldset for the first time, the class is removed, while clicking for the second time the class is added and the fieldset is collapsed.
How do I force a fieldset to be collapsed by default?