Fix automation group dropdown clipped at bottom of page

Dropdown always opened downward, getting cut off for the last row.
Now checks available space and flips upward when near viewport bottom.
pull/253/head
Broque Thomas 2 months ago
parent e8e8a2e934
commit b4da777bdc

@ -55960,12 +55960,19 @@ function _showGroupDropdown(event, autoId, currentGroup) {
// Position dropdown on document.body to avoid overflow:hidden clipping
const rect = btn.getBoundingClientRect();
dropdown.style.position = 'fixed';
dropdown.style.top = (rect.bottom + 4) + 'px';
dropdown.style.right = (window.innerWidth - rect.right) + 'px';
dropdown.style.left = 'auto';
document.body.appendChild(dropdown);
_activeGroupDropdown = dropdown;
// Open upward if not enough room below
const dropdownHeight = dropdown.offsetHeight;
if (rect.bottom + 4 + dropdownHeight > window.innerHeight && rect.top - 4 - dropdownHeight > 0) {
dropdown.style.top = (rect.top - 4 - dropdownHeight) + 'px';
} else {
dropdown.style.top = (rect.bottom + 4) + 'px';
}
// Focus the input
setTimeout(() => dropdown.querySelector('.auto-group-input')?.focus(), 50);

Loading…
Cancel
Save