mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #1978 from keepassxreboot/fix/autocomplete_fill_on_enter
Fix Autocomplete Menu fill on Enter when list is sorted
This commit is contained in:
commit
88db011cc9
3 changed files with 10 additions and 7 deletions
|
|
@ -33,7 +33,7 @@ class Autocomplete {
|
|||
|
||||
}
|
||||
|
||||
async itemEnter(index, elements) {
|
||||
async itemEnter(index, item) {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -132,6 +132,7 @@ class Autocomplete {
|
|||
for (const c of this.elements) {
|
||||
const item = document.createElement('div');
|
||||
item.textContent = c.label;
|
||||
item.setAttribute('uuid', c.uuid);
|
||||
|
||||
const itemInput = kpxcUI.createElement('input', '', { 'type': 'hidden', 'value': c.value });
|
||||
item.append(itemInput);
|
||||
|
|
@ -220,7 +221,7 @@ class Autocomplete {
|
|||
if (this.index >= 0 && items[this.index] !== undefined) {
|
||||
cancelEvent(e);
|
||||
|
||||
await this.itemEnter(this.index, this.elements);
|
||||
await this.itemEnter(this.index, items[this.index]);
|
||||
this.closeList();
|
||||
}
|
||||
} else if (e.key === 'Tab' && this.input) {
|
||||
|
|
|
|||
|
|
@ -30,9 +30,10 @@ CredentialAutocomplete.prototype.itemClick = async function(e, input, uuid) {
|
|||
input.focus();
|
||||
};
|
||||
|
||||
CredentialAutocomplete.prototype.itemEnter = async function(index, elements) {
|
||||
const usernameValue = elements[index].value;
|
||||
this.fillPassword(usernameValue, index, elements[index].uuid);
|
||||
CredentialAutocomplete.prototype.itemEnter = async function(index, item) {
|
||||
const usernameValue = item?.getElementsByTagName('input')[0].value;
|
||||
const uuid = item?.getAttribute('uuid');
|
||||
this.fillPassword(usernameValue, index, uuid);
|
||||
};
|
||||
|
||||
CredentialAutocomplete.prototype.fillPassword = async function(value, index, uuid) {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ TOTPAutocomplete.prototype.itemClick = async function(e, input, uuid) {
|
|||
input.focus();
|
||||
};
|
||||
|
||||
TOTPAutocomplete.prototype.itemEnter = async function(index, elements) {
|
||||
this.fillTotp(index, elements[index].uuid);
|
||||
TOTPAutocomplete.prototype.itemEnter = async function(index, item) {
|
||||
const uuid = item?.getAttribute('uuid');
|
||||
this.fillTotp(index, uuid);
|
||||
};
|
||||
|
||||
TOTPAutocomplete.prototype.fillTotp = async function(index, uuid, currentInput) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue