MCPcopy
hub / github.com/adobe/react-spectrum / isScrollable

Function isScrollable

packages/react-aria/src/utils/isScrollable.ts:13–31  ·  view source on GitHub ↗
(node: Element | null, checkForOverflow?: boolean)

Source from the content-addressed store, hash-verified

11 */
12
13export function isScrollable(node: Element | null, checkForOverflow?: boolean): boolean {
14 if (!node) {
15 return false;
16 }
17 let style = window.getComputedStyle(node);
18 let root = document.scrollingElement || document.documentElement;
19 let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
20
21 // Root element has `visible` overflow by default, but is scrollable nonetheless.
22 if (node === root && style.overflow !== 'hidden') {
23 isScrollable = true;
24 }
25
26 if (isScrollable && checkForOverflow) {
27 isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
28 }
29
30 return isScrollable;
31}

Callers 9

getScrollParentFunction · 0.90
getScrollParentsFunction · 0.90
getKeyPageAboveMethod · 0.90
getKeyPageBelowMethod · 0.90
onTouchStartFunction · 0.90
useAutoScrollFunction · 0.90
ModalOverlayInnerFunction · 0.90
Table.tsxFile · 0.90
UnderlayFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected