Skip to content

Commit fbcca2a

Browse files
committed
fix: Add safe navigation to arrow position calculation
Add safe navigation to arrow position calculation to prevent errors when any of the elements in the calculation does not exist.
1 parent fd2efbf commit fbcca2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/VueDatePicker/components/DatepickerMenu.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@
249249
if (defaultedConfig.value.arrowLeft) return defaultedConfig.value.arrowLeft;
250250
const menuRect = dpMenuRef.value?.getBoundingClientRect();
251251
const inputRect = props.getInputRect();
252-
if (inputRect.width < calendarWidth.value && inputRect.left <= (menuRect?.left ?? 0)) {
253-
return `${inputRect.width / 2}px`;
252+
if (inputRect?.width < calendarWidth?.value && inputRect?.left <= (menuRect?.left ?? 0)) {
253+
return `${inputRect?.width / 2}px`;
254254
}
255255
return '50%';
256256
});

0 commit comments

Comments
 (0)