MCPcopy Create free account
hub / github.com/dailydotdev/apps / onScroll

Function onScroll

packages/shared/src/components/auth/EmailCodeVerification.tsx:123–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121 }
122 };
123 const onScroll = () => {
124 if (Date.now() > resetUntil || window.scrollY <= 0) {
125 return;
126 }
127
128 const input = document.activeElement as HTMLElement | null;
129
130 if (!input || !isCodeInput(input)) {
131 return;
132 }
133
134 const viewportHeight =
135 window.visualViewport?.height ?? window.innerHeight;
136 const { bottom } = input.getBoundingClientRect();
137
138 if (bottom + window.scrollY <= viewportHeight) {
139 window.scrollTo(0, 0);
140 }
141 };
142
143 document.addEventListener('focusin', onFocusIn);
144 window.visualViewport?.addEventListener('resize', onViewportResize);

Callers

nothing calls this directly

Calls 2

isCodeInputFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected