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

Removing focus after deselect_all and select_all #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

atomicpages
Copy link

@atomicpages atomicpages commented Feb 6, 2017

Ran into an issue where I had an input field determine which items which be added to the selected box. The focus method was causing the input field to lose focus. See the following case:

<input type="email" placeholder="[email protected]">
<select id="shuttle">
  <option value="[email protected]">[email protected]</option>
  <option value="[email protected]">[email protected]</option>
  <option value="[email protected]">[email protected]</option>
</select>
function foo() {
  var prev = '';
  $('input[type="email"]').on('keyup', function (e) {
    if ($(e.target).val() !== prev) {
      $shuttle.multiSelect('deselect_all'); // caused a focus change and bad UX
      // ...
    }
  }).on('focus', function (e) {
    prev = $(e.target).val();
  });
}

I don't think focusing on the shuttle after other of these method invocations is necessary.

Note: Test compiled + all unit tests passed.

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

Successfully merging this pull request may close these issues.

1 participant