Skip to content

Commit 4e0ff09

Browse files
committed
fix: Change scrollable parent check depending on the config.shadowDom property (fixes #940)
1 parent 49b2f96 commit 4e0ff09

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/VueDatePicker/composables/position.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ 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-
return getScrollableParent((el.assignedSlot ? el.assignedSlot.parentNode : el.parentNode) as HTMLElement);
236+
const parent = defaultedConfig.value.shadowDom ? 'parentNode' : 'parentElement';
237+
return getScrollableParent((el.assignedSlot ? el.assignedSlot[parent] : el[parent]) as HTMLElement);
237238
};
238239

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

0 commit comments

Comments
 (0)