jumbo merge part two

This commit is contained in:
Vladimir Mandic
2023-06-14 11:22:59 -04:00
parent a9f66cb33e
commit 0ddf613b49
28 changed files with 175 additions and 213 deletions
+11 -7
View File
@@ -97,12 +97,16 @@ document.addEventListener('keydown', (e) => {
* checks that a UI element is not in another hidden element or tab content
*/
function uiElementIsVisible(el) {
let isVisible = !el.closest('.\\!hidden');
if (el === document) return true;
const computedStyle = getComputedStyle(el);
const isVisible = computedStyle.display !== 'none';
if (!isVisible) return false;
while (isVisible = el.closest('.tabitem')?.style.display !== 'none') {
if (!isVisible) return false;
if (el.parentElement) el = el.parentElement;
else break;
}
return isVisible;
return uiElementIsVisible(el.parentNode);
}
function uiElementInSight(el) {
const clRect = el.getBoundingClientRect();
const windowHeight = window.innerHeight;
const isOnScreen = clRect.bottom > 0 && clRect.top < windowHeight;
return isOnScreen;
}