MCPcopy Index your code
hub / github.com/JedWatson/react-select / getScrollParent

Function getScrollParent

packages/react-select/src/utils.ts:200–222  ·  view source on GitHub ↗
(element: HTMLElement)

Source from the content-addressed store, hash-verified

198// ------------------------------
199
200export function getScrollParent(element: HTMLElement) {
201 let style = getComputedStyle(element);
202 const excludeStaticParent = style.position === 'absolute';
203 const overflowRx = /(auto|scroll)/;
204
205 if (style.position === 'fixed') return document.documentElement;
206
207 for (
208 let parent: HTMLElement | null = element;
209 (parent = parent.parentElement);
210
211 ) {
212 style = getComputedStyle(parent);
213 if (excludeStaticParent && style.position === 'static') {
214 continue;
215 }
216 if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) {
217 return parent;
218 }
219 }
220
221 return document.documentElement;
222}
223
224// Animated Scroll To
225// ------------------------------

Callers 1

getMenuPlacementFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…