This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user