From 3f4825cc4cff41ecfa3467440727f4dc038cf838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20V=C3=A4nttinen?= Date: Sat, 5 Oct 2024 16:35:26 +0300 Subject: [PATCH] Add icon offset exception to Royal Bank Canada (#2356) Add icon offset exception to Royal Bank Canada --- keepassxc-browser/common/sites.js | 13 ++++++++----- keepassxc-browser/content/ui.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/keepassxc-browser/common/sites.js b/keepassxc-browser/common/sites.js index 208d86c..ad337aa 100644 --- a/keepassxc-browser/common/sites.js +++ b/keepassxc-browser/common/sites.js @@ -210,14 +210,17 @@ kpxcSites.popupExceptionFound = function(combinations) { /** * Handles a few exceptions for certain sites where Username Icon is not placed properly. - * @param {number} left Absolute left position of the icon - * @param {number} top Absolute top position of the icon - * @param {number} iconSize Size of the icon - * @returns {array} New left and top values as an Array + * @param {number} left Absolute left position of the icon + * @param {number} top Absolute top position of the icon + * @param {number} iconSize Size of the icon + * @param {string} inputType Input field type + * @returns {array} New left and top values as an Array */ -kpxcSites.iconOffset = function(left, top, iconSize) { +kpxcSites.iconOffset = function(left, top, iconSize, inputType) { if (document.location.hostname.includes('idmsa.apple.com')) { return [ left - (iconSize + 10), top + 3 ]; + } else if (document.location.origin === 'https://secure.royalbank.com' && inputType === 'password') { + return [ left - (iconSize + 10), top ]; } return undefined; diff --git a/keepassxc-browser/content/ui.js b/keepassxc-browser/content/ui.js index f4995db..70e62e7 100644 --- a/keepassxc-browser/content/ui.js +++ b/keepassxc-browser/content/ui.js @@ -164,7 +164,7 @@ kpxcUI.setIconPosition = function(icon, field, rtl = false, segmented = false) { } // Adjusts the icon offset for certain sites - const iconOffset = kpxcSites.iconOffset(left, top, size); + const iconOffset = kpxcSites.iconOffset(left, top, size, field?.getLowerCaseAttribute('type')); if (iconOffset) { left = iconOffset[0]; top = iconOffset[1];