Chosen isn't displayed correctly in a "overflow-y:hidden" area

Created on 23 January 2025, 3 months ago

Problem/Motivation

When the Chosen library is applied to an element located within an area styled with overflow: hidden, the dropdown field does not display the items properly when expanded.

Steps to reproduce

  1. Download and install the latest version of Drupal core and the Gin theme.
  2. Install the latest versions of the Webform and Webform UI modules.
  3. Configure Chosen using the following settings:
  4. Edit any field in the Contact webform and navigate to the Conditions tab.
  5. Attempt to open any of the select dropdown elements.

Proposed resolution

The issue stems from a known problem with Chosen and overflow: hidden areas, as documented in this open issue on Chosen's GitHub repository.
One potential solution is to dynamically apply overflow: auto to parent containers when a Chosen dropdown is present in the affected area. This allows the dropdown to render correctly, as demonstrated below:

As a non-frontend developer, this is my proposed workaround. If there are better approaches or further considerations to account for, I welcome feedback.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇷Brazil hfernandes

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024