Fixed #2872 - Dropdown: UpArrow triggers "Uncaught TypeError.." Firefox, Nuxt 3

This commit is contained in:
mertsincan 2022-08-23 10:38:43 +01:00
parent aafa0ca3a1
commit 615c09a9c7
6 changed files with 33 additions and 14 deletions

View file

@ -222,5 +222,24 @@ export default {
isPrintableCharacter(char = '') {
return this.isNotEmpty(char) && char.length === 1 && char.match(/\S| /);
},
/**
* Firefox-v103 does not currently support the "findLastIndex" method. It is stated that this method will be supported with Firefox-v104.
* https://caniuse.com/mdn-javascript_builtins_array_findlastindex
*/
findLastIndex(arr, callback) {
let index = -1;
if (this.isNotEmpty(arr)) {
try {
index = arr.findLastIndex(callback);
}
catch {
index = arr.lastIndexOf([...arr].reverse().find(callback));
}
}
return index;
}
}