Skip to content

Commit 71257b3

Browse files
committed
fix: Prevent assignedSlot.parentNode check depending on config.shadowDom property (fixes #940)
1 parent 4e0ff09 commit 71257b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/VueDatePicker/composables/position.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,11 @@ export const usePosition = ({
233233
const getScrollableParent = function (el: HTMLElement | null): Window | HTMLElement {
234234
if (!el || el === document.body || el.nodeType === Node.DOCUMENT_FRAGMENT_NODE) return window;
235235
if (isScrollable(el)) return el;
236-
const parent = defaultedConfig.value.shadowDom ? 'parentNode' : 'parentElement';
237-
return getScrollableParent((el.assignedSlot ? el.assignedSlot[parent] : el[parent]) as HTMLElement);
236+
return getScrollableParent(
237+
(el.assignedSlot && defaultedConfig.value.shadowDom
238+
? el.assignedSlot.parentNode
239+
: el.parentNode) as HTMLElement,
240+
);
238241
};
239242

240243
const getShadowPos = (rect?: DOMRect) => {

0 commit comments

Comments
 (0)