Width of select tags via Chosen are set to 0px

Created on 28 July 2021, over 3 years ago
Updated 2 January 2024, over 1 year ago

Problem/Motivation

On my site I use Chosen only on admin pages. We use the adminimal theme for admin pages. The width of single and multi-select Chosen containers is set to 0px, which makes them all but useless without manually changing the width via dev tools. This happens for containers with choices selected and with no choices selected.

Steps to reproduce

On my site, I can find a multi-select element by adding a filter in a view and exposing it to visitors. The Options field is a multi-select and the width will be 0px (see attached screenshot named view-filter-options.png). I can find a single select by clicking Add media when creating new content. One of the filters on our media library form is a single select element (see attached screenshot named media-library.png).

Proposed resolution

I suspect the getElementOptions section of chosen.js where it sets the width may have something to do with it, but unfortunately I don't have the time to investigate right now.

For now, I've added some code to chosen-drupal.css that adequately addresses the issue. The patch is attached to this issue.

Remaining tasks

Investigate and address the root cause of the issue, whether that's the width being set in chosen.js or something else.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇺🇸United States jsutta United States

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024