Fix horizontal scrolling in admin UI
build / build-linux-amd64 (push) Successful in 1m56s

This commit is contained in:
2026-05-25 00:19:14 +02:00
parent bc61ec6046
commit d941ae9739
3 changed files with 43 additions and 12 deletions
+27
View File
@@ -262,6 +262,33 @@
});
}
window.devicesPageSize = devicesPageSize;
// The devices table lives inside an `overflow-x-auto` wrapper so wide
// column sets get a horizontal scrollbar instead of pushing the page
// out. CSS forces overflow-y to auto on the same axis, which would
// clip the per-row action popover (a `<details>` > `<div>` inside a
// <td>). On toggle we flip the popover to `position: fixed` and pin
// it to the summary's viewport rect so it escapes the scroll context.
// Inline `ontoggle=` is preserved across htmx swaps without re-binding.
function actionMenuToggle(details) {
const popover = details.querySelector('[data-action-menu]');
if (!popover) return;
if (!details.open) {
popover.style.position = '';
popover.style.top = '';
popover.style.left = '';
popover.style.right = '';
return;
}
const summary = details.querySelector('summary');
if (!summary) return;
const rect = summary.getBoundingClientRect();
popover.style.position = 'fixed';
popover.style.top = rect.bottom + 4 + 'px';
popover.style.right = (window.innerWidth - rect.right - 8) + 'px';
popover.style.left = 'auto';
}
window.actionMenuToggle = actionMenuToggle;
</script>
</body>
</html>