Skip to content

Commit

Permalink
Add icon offset exception to Royal Bank Canada (#2356)
Browse files Browse the repository at this point in the history
Add icon offset exception to Royal Bank Canada
  • Loading branch information
varjolintu authored Oct 5, 2024
1 parent 4792d44 commit 3f4825c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions keepassxc-browser/common/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion keepassxc-browser/content/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 3f4825c

Please sign in to comment.