Merge pull request #2693 from keepassxreboot/feature/add_overlay_exceptions

Add overlay exceptions feature
This commit is contained in:
Sami Vänttinen 2025-09-20 15:54:39 +03:00 committed by GitHub
commit 84374d1d13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;