Skip to content

Commit

Permalink
fix: issue with getComputedStyle and getScrollingParent
Browse files Browse the repository at this point in the history
  • Loading branch information
Clauderic Demers committed Mar 19, 2019
1 parent 822193d commit b104249
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function isScrollable(el) {
}

export function getScrollingParent(el) {
if (!el) {
if (!(el instanceof HTMLElement)) {
return null;
} else if (isScrollable(el)) {
return el;
Expand Down

1 comment on commit b104249

@jeffy-g
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about using the parentElement property?

export function getScrollingParent(el) {
  if (!el) {
    return null;
  } else if (isScrollable(el)) {
    return el;
  } else {
    return getScrollingParent(el.parentElement);
  }
}

Please sign in to comment.