Add overlay exceptions feature

This commit is contained in:
varjolintu 2025-09-20 10:09:06 +03:00
parent bbff228b40
commit d1f6f611a6
2 changed files with 18 additions and 0 deletions

View file

@ -235,6 +235,20 @@ kpxcSites.popupExceptionFound = function(combinations) {
return false;
};
/**
* Handles exceptions where a certain element is set as a popover, and it prevents input field detections.
* @param {object} elem Popover element
* @returns {boolean} True if exception found
*/
kpxcSites.overlayExceptionFound = function(elem) {
if (document.location.href?.startsWith('https://github.com/login')
&& elem?.nodeName === 'TOOL-TIP' && elem?.baseURI === 'https://github.com/login') {
return true;
}
return false;
};
/**
* Handles a few exceptions for certain sites where Username Icon is not placed properly.
* @param {number} left Absolute left position of the icon

View file

@ -495,6 +495,10 @@ kpxcFields.isTopElement = function(elem, rect) {
// Check for popup overlays
for (const overlay of kpxcFields.overlays ?? []) {
if (kpxcSites.overlayExceptionFound(overlay)) {
continue;
}
const overlayRect = overlay?.getBoundingClientRect();
if (overlayRect && elementsOverlap(rect, overlayRect)) {
return false;