I have my Chosen form elements inside a collapsiblock block. If the status of the block is expanded, the chosen elements on the form initialize properly with their minimum width. However, if the collapsiblock containing the form element is collapsed when the page loads initially, then the Chosen elements inside have a zero-width.
After poking around a bit with the chosen.jquery library, I believe the solution is to specify the minimum width as an option like so inside of the module's provided chosen.js script:
options.width = Drupal.settings.chosen.minimum_width+'px';
I'll follow up opening this issue with a patch that proposes to do this.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2004342-chosen-force-min-width-on-hidden-elements.patch | 553 bytes | mstrelan |
#1 | chosen-hidden-0-width-2004342-2.patch | 543 bytes | tlarrieu |
Comments
Comment #1
tlarrieu CreditAttribution: tlarrieu commentedAttaching patch file with suggested fix.
Comment #2
mstrelan CreditAttribution: mstrelan commentedAttached patch is more respectful of the width as a minimum, as it will only force the width if the computed width is less than the minimum. It requires at least v0.9.13 of Chosen JS. I wonder if we could also tap in to vertical tabs and collapsible fieldsets to use a truly automatic width.
Comment #3
Mołot CreditAttribution: Mołot commentedWorks for me, but I needed to apply it manually. Now that part looks like that for me:
Comment #4
FabianMeul CreditAttribution: FabianMeul commented#2 is working for me! Thx!
Comment #5
Lex-DRL CreditAttribution: Lex-DRL commentedConfirming, patch from #2 works for me, too.
Comment #6
Mołot CreditAttribution: Mołot commentedComment #7
Hydra CreditAttribution: Hydra commentedFor me this looks like a duplicate of https://drupal.org/node/2051119#comment-7688649 wich is commited now. If this is still an issue, please reopen.