Skip to content

Commit 6a25122

Browse files
authored
Merge pull request #109 from PottyZA/master
Fix for elementCanBeScrolled failing if node is not an HTMLElement inside a shadow root
2 parents 3c05dd6 + baa56c3 commit 6a25122

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/handleScroll.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { Axis } from './types';
1+
import {Axis} from './types';
22

33
const alwaysContainsScroll = (node: HTMLElement): boolean =>
44
// textarea will always _contain_ scroll inside self. It only can be hidden
55
node.tagName === 'TEXTAREA';
66

77
const elementCanBeScrolled = (node: HTMLElement, overflow: 'overflowX' | 'overflowY'): boolean => {
8+
if (!(node instanceof HTMLElement)) return false;
9+
810
const styles = window.getComputedStyle(node);
911

1012
return (

0 commit comments

Comments
 (0)