Skip to content

Commit

Permalink
FIX for tractorcow#45: Prevent focus on AutocompleteField prior to in…
Browse files Browse the repository at this point in the history
…itializing jQuery UI autocomplete (due to bug in "change" event firing incorrectly).
  • Loading branch information
patricknelson committed Nov 14, 2019
1 parent 57ad821 commit 66582c4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions javascript/AutocompleteField.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
return;
$input.attr('data-loaded', 'true');

// Prevent this field from initializing with autocomplete while focused. Required to prevent an
// accidental misfire in the jQuery UI autocomplete "change" event that occurs if: 1.) Field starts out
// with focus and 2.) You click away to remove focus.
$input.blur();

// load autocomplete into this field
$input.autocomplete({
source: source,
Expand Down

0 comments on commit 66582c4

Please sign in to comment.