multi-select
multi-select copied to clipboard
Removing focus after deselect_all and select_all
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.