From b2f7f9386e43bc1d53bc23948d0fc3d8ee5ac0e9 Mon Sep 17 00:00:00 2001 From: James Lucas Date: Fri, 1 Jul 2022 10:42:32 +1000 Subject: [PATCH] Input elements in Safari lose focus when the list attribute is added. As a workaround, we set a non-existing dataset id to disable auto-completion instead of removing the attribute. The list attribute is then set from Tagger initialisation. --- tagger.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tagger.js b/tagger.js index 5239919..7d96529 100644 --- a/tagger.js +++ b/tagger.js @@ -145,6 +145,7 @@ wrapper.appendChild(this._ul); li.appendChild(this._completion); this._add_events(); + this._toggle_completion(false); if (this._settings.completion.list instanceof Array) { this._build_completion(this._settings.completion.list); } @@ -233,7 +234,7 @@ if (toggle) { this._new_input_tag.setAttribute('list', 'tagger-completion-' + this._id); } else { - this._new_input_tag.removeAttribute('list'); + this._new_input_tag.setAttribute('list', 'tagger-completion-disabled-' + this._id); } }, // --------------------------------------------------------------------------------------