Skip to content

Commit

Permalink
fix(CalendarMonth): fix selection closing datepicker popover (#11341)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul authored Dec 10, 2024
1 parent 2de9fea commit d8c26ac
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
>
<SelectList>
{longMonths.map((longMonth, index) => (
Expand Down

0 comments on commit d8c26ac

Please sign in to comment.