export function makeVisible(menu: HTMLElement, x: number, y: number): void { const { scrollWidth } = document.documentElement; const { left, right } = menu.getBoundingClientRect(); const menuWidth = right - left; const outOfScreen = x + right >= scrollWidth; menu.style.left = `${outOfScreen ? x - menuWidth : x}px`; menu.style.top = `${y}px`; menu.style.visibility = "visible"; }