Files
overleaf-cep/services/web/frontend/js/shared/utils/element-in-view.ts
T
Jessica Lawshe 66671f9bf2 Merge pull request #34936 from overleaf/jel-scroll-to-notification
[web] Scroll to new notification added above domains table

GitOrigin-RevId: f62851398de3a54ef07c0e125c65a29dd84af6f8
2026-09-17 11:33:41 +00:00

6 lines
232 B
TypeScript

export function elementIsInView(el: HTMLElement): boolean {
const rect = el.getBoundingClientRect()
// Any vertical intersection with the viewport counts as "in view".
return rect.bottom > 0 && rect.top < window.innerHeight
}