Hide username icon properly when needed

This commit is contained in:
varjolintu 2020-03-17 16:57:43 +02:00
parent ffd257bbdf
commit b6ef3456f8
4 changed files with 4 additions and 5 deletions

View file

@ -146,8 +146,8 @@ kpxcBanner.saveNewCredentials = async function(credentials = {}) {
// Only the Root group and no KeePassXC-Browser passwords -> save to default
// Or when default group is not set and defaultGroupAskAlways is disabled -> save to default
if ((result.groups === undefined || (result.groups.length > 0 && result.groups[0].children.length === 0)) ||
(!result.defaultGroupAlwaysAsk && (result.defaultGroup === '' || result.defaultGroup === DEFAULT_BROWSER_GROUP))) {
if ((result.groups === undefined || (result.groups.length > 0 && result.groups[0].children.length === 0))
|| (!result.defaultGroupAlwaysAsk && (result.defaultGroup === '' || result.defaultGroup === DEFAULT_BROWSER_GROUP))) {
const args = [ credentials.username, credentials.password, credentials.url ];
// If root group is defined by the user, and there's no default browser group, save the credentials to the root group

View file

@ -1028,7 +1028,7 @@ kpxc.initPasswordGenerator = function(inputs) {
}
};
kpxc.initOTPFields = function(inputs, databaseClosed) {
kpxc.initOTPFields = function(inputs) {
for (const i of inputs) {
const id = i.getLowerCaseAttribute('id');
const name = i.getLowerCaseAttribute('name');

View file

@ -104,7 +104,6 @@ kpxcUI.setIconPosition = function(icon, field) {
kpxcUI.updateFromIntersectionObserver = function(iconClass, entries) {
for (const entry of entries) {
const rect = DOMRectToArray(entry.boundingClientRect);
const temp = entry.target.closest('.kpxc-username-icon');
if ((entry.intersectionRatio === 0 && !entry.isIntersecting) || (rect.some(x => x < -10))) {
iconClass.icon.style.display = 'none';

View file

@ -41,7 +41,7 @@ class UsernameFieldIcon extends Icon {
}
UsernameFieldIcon.prototype.initField = function(field) {
if (!field || field.getAttribute('kpxc-username-field') === 'true') {
if (!field || field.getAttribute('kpxc-username-field') === 'true' || !kpxcFields.isVisible(field)) {
return;
}