v1.8.35: dropdown full-width on mobile — no overlap possible

This commit is contained in:
2026-05-28 23:15:09 +00:00
parent 97653ef882
commit 3cacf637f1
9 changed files with 13 additions and 5 deletions
+13 -5
View File
@@ -210,11 +210,19 @@
e.stopPropagation();
const btn = document.getElementById('uh-btn');
const rect = btn.getBoundingClientRect();
drop.style.top = (rect.bottom + 6) + 'px';
drop.style.left = rect.left + 'px';
// Keep within viewport
const rightEdge = rect.left + 176;
if (rightEdge > window.innerWidth - 8) drop.style.left = (window.innerWidth - 184) + 'px';
drop.style.top = (rect.bottom + 6) + 'px';
if (window.innerWidth < 640) {
// Mobile: full width below header, no overlap possible
drop.style.left = '8px';
drop.style.right = '8px';
drop.style.width = 'auto';
} else {
// Desktop: align to button
drop.style.right = 'auto';
drop.style.width = '11rem';
const left = Math.max(8, Math.min(rect.left, window.innerWidth - 184));
drop.style.left = left + 'px';
}
drop.classList.toggle('hidden');
});