MCPcopy
hub / github.com/flatpickr/flatpickr / focusOnDay

Function focusOnDay

src/index.ts:823–845  ·  view source on GitHub ↗
(current: DayElement | undefined, offset: number)

Source from the content-addressed store, hash-verified

821 }
822
823 function focusOnDay(current: DayElement | undefined, offset: number) {
824 const activeElement = getClosestActiveElement();
825
826 const dayFocused = isInView(activeElement || document.body);
827 const startElem =
828 current !== undefined
829 ? current
830 : dayFocused
831 ? (activeElement as DayElement)
832 : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
833 ? self.selectedDateElem
834 : self.todayDateElem !== undefined && isInView(self.todayDateElem)
835 ? self.todayDateElem
836 : getFirstAvailableDay(offset > 0 ? 1 : -1);
837
838 if (startElem === undefined) {
839 self._input.focus();
840 } else if (!dayFocused) {
841 focusOnDayElem(startElem);
842 } else {
843 getNextAvailableDay(startElem, offset);
844 }
845 }
846
847 function buildMonthDays(year: number, month: number) {
848 const firstOfMonth =

Callers 2

getNextAvailableDayFunction · 0.85
onKeyDownFunction · 0.85

Calls 5

getClosestActiveElementFunction · 0.85
isInViewFunction · 0.85
getFirstAvailableDayFunction · 0.85
focusOnDayElemFunction · 0.85
getNextAvailableDayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…