Do not autofill the password when Tab is pressed if the list has been closed.

This commit is contained in:
Stefan Sundin 2021-11-07 12:46:34 -08:00
parent 1c3538f316
commit 2cbb7bc458

View file

@ -200,6 +200,11 @@ class Autocomplete {
this.closeList();
}
} else if (e.key === 'Tab') {
// Return if the list is not open
if (items.length === 0) {
return;
}
// Return if value is not in the list
if (inputField.value !== '' && !this.elements.some(c => c.value === inputField.value)) {
this.closeList();