Add icon offset exception to Royal Bank Canada (#2356)

Add icon offset exception to Royal Bank Canada
This commit is contained in:
Sami Vänttinen 2024-10-05 16:35:26 +03:00 committed by GitHub
parent 4792d44af8
commit 3f4825cc4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -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;

View file

@ -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];