Skip to content

Dropdown is visible and items are selectable when the input element is disabled #56

Open
@peterserfozo

Description

@peterserfozo

The dropdown is visible and you can select items when the input element is disabled:

<select class="chosen-select" multiple disabled>
  <option>Praesent vestibulum dapibus nibh</option>
  <option selected>Vestibulum facilisis purus</option>
  <option>Etiam ultricies nisi</option>
</select>
Screenshot 2024-08-09 at 17 02 13

Steps to reproduce

  1. Create a select input element and add the disabled attribute to it

  2. Click on the select element, the grey/transparent dropdown is visible. You can select items.

https://jsfiddle.net/Lj2qzbwf/

Expected behavior

If the field is disabled then it is not possible to interact with it.

Additional information

https://github.com/JJJ/chosen/blob/master/docs/chosen.jquery.js#L1204
In the container_mousedown() function, the is_disabled check is not correctly implemented.

The disabled state must be checked at the beginning of the function. See https://github.com/harvesthq/chosen/blob/master/coffee/chosen.jquery.coffee#L134

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions