` > `` inside a
+ //
). 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;
|