Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
peterserfozo opened this issue Aug 9, 2024 · 1 comment

Comments

@peterserfozo
Copy link

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

@peterserfozo peterserfozo mentioned this issue Aug 9, 2024
5 tasks
@peterserfozo
Copy link
Author

The fix is in the PR: #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant