Skip to content

Commit

Permalink
Update autocomplete.js to v2.1.10 (vufind-org#3762)
Browse files Browse the repository at this point in the history
  • Loading branch information
crhallberg authored Jun 7, 2024
1 parent 19c43e7 commit 7b4320b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
12 changes: 10 additions & 2 deletions themes/bootstrap3/js/vendor/autocomplete.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -75,6 +75,9 @@ function Autocomplete(_settings) {

clearTimeout(debounceTimeout);
_currentIndex = -1;
if (lastInput) {
lastInput.setAttribute('aria-expanded', 'false');
}
lastInput = false;
lastCB = null;
}
Expand Down Expand Up @@ -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');
});
}

Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion themes/bootstrap3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 10 additions & 2 deletions themes/bootstrap5/js/vendor/autocomplete.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -75,6 +75,9 @@ function Autocomplete(_settings) {

clearTimeout(debounceTimeout);
_currentIndex = -1;
if (lastInput) {
lastInput.setAttribute('aria-expanded', 'false');
}
lastInput = false;
lastCB = null;
}
Expand Down Expand Up @@ -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');
});
}

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 7b4320b

Please sign in to comment.