From b2870c26c0d74a639c8b1f71895df9c5fd3a4958 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Tue, 9 Nov 2021 08:10:41 -0800 Subject: [PATCH] Return early if there are no credentials. This fixes an annoying behavior where the extension selects the contents of a text field that does not contain credentials (e.g. misidentified TOTP field). Selecting the contents of a text field when it is clicked is not normal behavior and feels really off. --- keepassxc-browser/content/autocomplete.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/keepassxc-browser/content/autocomplete.js b/keepassxc-browser/content/autocomplete.js index e382d0c..8a93d36 100644 --- a/keepassxc-browser/content/autocomplete.js +++ b/keepassxc-browser/content/autocomplete.js @@ -60,6 +60,12 @@ class Autocomplete { async showList(inputField) { this.closeList(); + + // Return if there are no credentials + if (this.elements.length === 0) { + return; + } + this.input = inputField; this.input.select();