From b7607b391fe00d00e0c42be2a49d97b8bdddc69c Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Tue, 10 Dec 2024 09:46:23 -0500 Subject: [PATCH] fix(CalendarMonth): fix selection closing datepicker popover --- .../components/CalendarMonth/CalendarMonth.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx b/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx index 0b399271133..c59357c3903 100644 --- a/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx +++ b/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx @@ -319,18 +319,15 @@ export const CalendarMonth = ({ onSelectToggle(isOpen); }} onSelect={(ev, monthNum) => { - // When we put CalendarMonth in a Popover we want the Popover's onDocumentClick - // to see the SelectOption as a child so it doesn't close the Popover. - setTimeout(() => { - setIsSelectOpen(false); - onSelectToggle(false); - const newDate = changeMonth(Number(monthNum as string)); - setFocusedDate(newDate); - setShouldFocus(false); - onMonthChange(ev, newDate); - }, 0); + setIsSelectOpen(false); + onSelectToggle(false); + const newDate = changeMonth(Number(monthNum as string)); + setFocusedDate(newDate); + setShouldFocus(false); + onMonthChange(ev, newDate); }} selected={monthFormatted} + popperProps={{ appendTo: 'inline' }} > {longMonths.map((longMonth, index) => (