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

Multi select with Chosen enabled in label deletes letters #2613

Open
Eisermann opened this issue Jun 2, 2016 · 1 comment
Open

Multi select with Chosen enabled in label deletes letters #2613

Eisermann opened this issue Jun 2, 2016 · 1 comment
Labels

Comments

@Eisermann
Copy link

Steps to reproduce

  1. Create <select multiple> element on your site.
  2. Wrap <select> with <label>. You should get sth like:

<label>
Your Label
<select id='test' multiple>
<option>a</option>
<option>b</option>
<option>c</option>
</select>
</label>
3. Enable Chosen on this select.
4. Select some option clicking with mouse on dropdown
5. There should appear selected option in Chosen field and cursor to write sth more (it's multiselect).
6. If you try to write sth now on key up it will disappear.

Here is live demo to this case:
https://jsfiddle.net/xkysq3bq/

Expected behavior

The written text should not disappear, but should be searched in dropdown

Actual behavior

The text disappears. You have to write it once again, after the dropdown is opened, to work.

Environment

  • Tested on: 1.4, 1.5
  • jQuery: 1.7.1
  • Chrome (the newest)
  • Ubuntu 16 LTS

Additional information

The problem does not happen when you use label with "for" and the select is not inside.

@koenpunt
Copy link
Collaborator

I think this is because a click on the select propagates to the label, which then focusses the select, which in turn focusses Chosen, which queues some invocation of input_focus.
To see this in action, open the live demo, open the web inspector, set a breakpoint in chosen.jquery.js on line 195, and follow the above reproduction steps.

@koenpunt koenpunt added the Bug label Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants