Skip to content

Commit

Permalink
fix(composable): prevent scrolling parent error with parent null (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek authored Feb 22, 2024
1 parent cefffc2 commit 34670d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/oruga-next/src/composables/useScrollingParent.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isDefined } from "@/utils/helpers";

/**
* Given an element, returns the element who scrolls it.
*/
Expand All @@ -8,7 +10,7 @@ export function getScrollingParent(target: HTMLElement): HTMLElement {
let isScrollingParent = false;
let nextParent = target.parentElement;

while (!isScrollingParent) {
while (!isScrollingParent && isDefined(nextParent)) {
if (nextParent === document.documentElement) break;

const { overflow, overflowY } = getComputedStyle(nextParent);
Expand Down

0 comments on commit 34670d4

Please sign in to comment.