From 7b4320b91bdabb3e4874093539cb05a3a06b2b1e Mon Sep 17 00:00:00 2001 From: Chris Hallberg Date: Fri, 7 Jun 2024 06:15:02 -0400 Subject: [PATCH] Update autocomplete.js to v2.1.10 (#3762) --- themes/bootstrap3/js/vendor/autocomplete.js | 12 ++++++++++-- themes/bootstrap3/package.json | 3 ++- themes/bootstrap5/js/vendor/autocomplete.js | 12 ++++++++++-- themes/bootstrap5/package.json | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/themes/bootstrap3/js/vendor/autocomplete.js b/themes/bootstrap3/js/vendor/autocomplete.js index b874ca7979c..0d861d5a849 100644 --- a/themes/bootstrap3/js/vendor/autocomplete.js +++ b/themes/bootstrap3/js/vendor/autocomplete.js @@ -1,4 +1,4 @@ -/* https://github.com/vufind-org/autocomplete.js (v2.1.9) (2024-02-26) */ +/* https://github.com/vufind-org/autocomplete.js (v2.1.10) (2024-06-06) */ function Autocomplete(_settings) { const _DEFAULTS = { delay: 250, @@ -75,6 +75,9 @@ function Autocomplete(_settings) { clearTimeout(debounceTimeout); _currentIndex = -1; + if (lastInput) { + lastInput.setAttribute('aria-expanded', 'false'); + } lastInput = false; lastCB = null; } @@ -197,6 +200,8 @@ function Autocomplete(_settings) { _searchCallback(items, input); _show(input); _align(input); + // Set aria-expanded here so that the load indicator isn't marked expanded + input.setAttribute('aria-expanded', 'true'); }); } @@ -295,12 +300,15 @@ function Autocomplete(_settings) { list.setAttribute("role", "listbox"); input.setAttribute("role", "combobox"); input.setAttribute("aria-autocomplete", "both"); + input.setAttribute('aria-expanded', 'false'); input.setAttribute("aria-controls", list.getAttribute("id")); input.setAttribute("enterkeyhint", "search"); // phone keyboard hint input.setAttribute("autocapitalize", "off"); // disable browser tinkering input.setAttribute("autocomplete", "off"); // ^ - input.setAttribute("autocorrect", "off"); // ^ input.setAttribute("spellcheck", "false"); // ^ + if (typeof input.autocorrect !== 'undefined') { + input.setAttribute("autocorrect", "off"); // ^ only with Safari + } // Activation / De-activation if (input.getAttribute("autofocus") !== null) { diff --git a/themes/bootstrap3/package.json b/themes/bootstrap3/package.json index 6c45f733c29..e017109ca52 100644 --- a/themes/bootstrap3/package.json +++ b/themes/bootstrap3/package.json @@ -2,10 +2,11 @@ "name": "vufind-bootstrap3", "description": "Dependencies for the bootstrap3 theme", "scripts": { + "installBuildDeps": "npm install && node tools/copyDependencies.mjs --only-build-deps", "updateDeps": "npm update && node tools/copyDependencies.mjs" }, "dependencies": { - "autocomplete.js": "vufind-org/autocomplete.js#v2.1.9", + "autocomplete.js": "vufind-org/autocomplete.js#v2.1.10", "chart.js": "^4.4.0", "jquery": "^3.7.1", "simple-keyboard": "^3.6.0", diff --git a/themes/bootstrap5/js/vendor/autocomplete.js b/themes/bootstrap5/js/vendor/autocomplete.js index b874ca7979c..0d861d5a849 100644 --- a/themes/bootstrap5/js/vendor/autocomplete.js +++ b/themes/bootstrap5/js/vendor/autocomplete.js @@ -1,4 +1,4 @@ -/* https://github.com/vufind-org/autocomplete.js (v2.1.9) (2024-02-26) */ +/* https://github.com/vufind-org/autocomplete.js (v2.1.10) (2024-06-06) */ function Autocomplete(_settings) { const _DEFAULTS = { delay: 250, @@ -75,6 +75,9 @@ function Autocomplete(_settings) { clearTimeout(debounceTimeout); _currentIndex = -1; + if (lastInput) { + lastInput.setAttribute('aria-expanded', 'false'); + } lastInput = false; lastCB = null; } @@ -197,6 +200,8 @@ function Autocomplete(_settings) { _searchCallback(items, input); _show(input); _align(input); + // Set aria-expanded here so that the load indicator isn't marked expanded + input.setAttribute('aria-expanded', 'true'); }); } @@ -295,12 +300,15 @@ function Autocomplete(_settings) { list.setAttribute("role", "listbox"); input.setAttribute("role", "combobox"); input.setAttribute("aria-autocomplete", "both"); + input.setAttribute('aria-expanded', 'false'); input.setAttribute("aria-controls", list.getAttribute("id")); input.setAttribute("enterkeyhint", "search"); // phone keyboard hint input.setAttribute("autocapitalize", "off"); // disable browser tinkering input.setAttribute("autocomplete", "off"); // ^ - input.setAttribute("autocorrect", "off"); // ^ input.setAttribute("spellcheck", "false"); // ^ + if (typeof input.autocorrect !== 'undefined') { + input.setAttribute("autocorrect", "off"); // ^ only with Safari + } // Activation / De-activation if (input.getAttribute("autofocus") !== null) { diff --git a/themes/bootstrap5/package.json b/themes/bootstrap5/package.json index 2ecff1e7896..d18632fcf38 100644 --- a/themes/bootstrap5/package.json +++ b/themes/bootstrap5/package.json @@ -7,7 +7,7 @@ }, "dependencies": { "@popperjs/core": "2.11.8", - "autocomplete.js": "vufind-org/autocomplete.js#v2.1.9", + "autocomplete.js": "vufind-org/autocomplete.js#v2.1.10", "bootstrap": "5.3.3", "chart.js": "^4.4.0", "jquery": "^3.7.1",