export function scrollIntoView(target: Element, options?: ScrollIntoViewOptions): Promise { const { promise, resolve } = Promise.withResolvers() const observer = new IntersectionObserver((entries) => { const [entry] = entries if (entry.isIntersecting) { observer.unobserve(target) observer.disconnect() setTimeout(() => { resolve() }, 100) } }) observer.observe(target) target.scrollIntoView(options) return promise }