Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
onSelectToggle?: (open: boolean) => void;
/** Functions that returns if a date is valid and selectable. */
validators?: ((date: Date) => boolean)[];
/** The container to append the month select menu to. Defaults to 'inline'.
* If your menu is being cut off you can append it to an element higher up the DOM tree.
* Some examples:
* monthAppendTo={() => document.body};
* monthAppendTo={document.getElementById('target')}
*/
Comment thread
coderabbitai[bot] marked this conversation as resolved.
monthAppendTo?: HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline';
Comment thread
kmcfaul marked this conversation as resolved.
}

const buildCalendar = (year: number, month: number, weekStart: number, validators: ((date: Date) => boolean)[]) => {
Expand Down Expand Up @@ -143,6 +150,7 @@
cellAriaLabel,
isDateFocused = false,
inlineProps,
monthAppendTo = 'inline',
...props
}: CalendarProps) => {
const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Expand Down Expand Up @@ -181,14 +189,14 @@
} else if (!dateProp) {
setFocusedDate(today);
}
}, [dateProp]);

Check warning on line 192 in packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has a missing dependency: 'focusedDate'. Either include it or remove the dependency array

useEffect(() => {
// Calendar month should not be focused on page load
if ((shouldFocus || isDateFocused) && focusedDateValidated && focusRef.current) {
focusRef.current.focus();
}
}, [focusedDate, isDateFocused, focusedDateValidated, focusRef]);

Check warning on line 199 in packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has a missing dependency: 'shouldFocus'. Either include it or remove the dependency array

const onMonthClick = (ev: React.MouseEvent, newDate: Date) => {
setFocusedDate(newDate);
Expand Down Expand Up @@ -327,7 +335,7 @@
onMonthChange(ev, newDate);
}}
selected={monthFormatted}
popperProps={{ appendTo: 'inline' }}
popperProps={{ appendTo: monthAppendTo }}
>
<SelectList>
{longMonths.map((longMonth, index) => (
Expand Down
Loading