mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Use defaultView instead of scrollingElement when positioning icons and menus (#1873)
Use defaultView instead of scrollingElement when positioning icons and menus
This commit is contained in:
parent
7bb0f83271
commit
dd9d316f13
4 changed files with 19 additions and 9 deletions
|
|
@ -283,12 +283,14 @@ class Autocomplete {
|
|||
this.container.classList.remove('kpxcAutocomplete-container-on-top');
|
||||
}
|
||||
|
||||
const scrollTop = kpxcUI.getScrollTop();
|
||||
const scrollLeft = kpxcUI.getScrollLeft();
|
||||
if (kpxcUI.bodyStyle.position.toLowerCase() === 'relative') {
|
||||
this.container.style.top = Pixels(rect.top - kpxcUI.bodyRect.top + document.scrollingElement.scrollTop + this.input.offsetHeight - menuOffset);
|
||||
this.container.style.left = Pixels(rect.left - kpxcUI.bodyRect.left + document.scrollingElement.scrollLeft);
|
||||
this.container.style.top = Pixels(rect.top - kpxcUI.bodyRect.top + scrollTop + this.input.offsetHeight - menuOffset);
|
||||
this.container.style.left = Pixels(rect.left - kpxcUI.bodyRect.left + scrollLeft);
|
||||
} else {
|
||||
this.container.style.top = Pixels(rect.top + document.scrollingElement.scrollTop + this.input.offsetHeight - menuOffset);
|
||||
this.container.style.left = Pixels(rect.left + document.scrollingElement.scrollLeft);
|
||||
this.container.style.top = Pixels(rect.top + scrollTop + this.input.offsetHeight - menuOffset);
|
||||
this.container.style.left = Pixels(rect.left + scrollLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -621,8 +621,8 @@ kpxcCustomLoginFieldsBanner.setSelectionPosition = function(field) {
|
|||
const rect = field.originalElement.getBoundingClientRect();
|
||||
const left = kpxcUI.getRelativeLeftPosition(rect);
|
||||
const top = kpxcUI.getRelativeTopPosition(rect);
|
||||
const scrollTop = document.scrollingElement ? document.scrollingElement.scrollTop : 0;
|
||||
const scrollLeft = document.scrollingElement ? document.scrollingElement.scrollLeft : 0;
|
||||
const scrollTop = kpxcUI.getScrollTop();
|
||||
const scrollLeft = kpxcUI.getScrollLeft();
|
||||
|
||||
field.style.top = Pixels(top + scrollTop);
|
||||
field.style.left = Pixels(left + scrollLeft);
|
||||
|
|
|
|||
|
|
@ -143,14 +143,22 @@ kpxcUI.setIconPosition = function(icon, field, rtl = false, segmented = false) {
|
|||
top = iconOffset[1];
|
||||
}
|
||||
|
||||
const scrollTop = document.scrollingElement ? document.scrollingElement.scrollTop : 0;
|
||||
const scrollLeft = document.scrollingElement ? document.scrollingElement.scrollLeft : 0;
|
||||
const scrollTop = kpxcUI.getScrollTop();
|
||||
const scrollLeft = kpxcUI.getScrollLeft();
|
||||
icon.style.top = Pixels(top + scrollTop + offset + 1);
|
||||
icon.style.left = rtl
|
||||
? Pixels((left + scrollLeft) + offset)
|
||||
: Pixels(left + scrollLeft + field.offsetWidth - size - offset);
|
||||
};
|
||||
|
||||
kpxcUI.getScrollTop = function() {
|
||||
return document.defaultView?.scrollY ?? document.scrollingElement?.scrollTop ?? 0;
|
||||
};
|
||||
|
||||
kpxcUI.getScrollLeft = function() {
|
||||
return document.defaultView?.scrollX ?? document.scrollingElement?.scrollLeft ?? 0;
|
||||
};
|
||||
|
||||
kpxcUI.getRelativeLeftPosition = function(rect) {
|
||||
return kpxcUI.bodyStyle.position.toLowerCase() === 'relative' ? rect.left - kpxcUI.bodyRect.left : rect.left;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
"applications": {
|
||||
"gecko": {
|
||||
"id": "keepassxc-browser@keepassxc.org",
|
||||
"strict_min_version": "67.0"
|
||||
"strict_min_version": "74.0"
|
||||
}
|
||||
},
|
||||
"default_locale": "en"
|
||||
|
|
|
|||
Loading…
Reference in a new issue