function handleScroll() {
      if (hideOnScroll && isVisible) closeCalendar();
    }
Due to the fact that by activating the portal mode,
the calendar element is moved out of the date picker container,
it is not possible to detect external clicks using the datePickerRef.
Therefore, inputRef and calendarRef can be checked separately.

If the clicked area is outside of both the input and calendar elements,
the calendar should be closed.