Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit add09c0

Browse files
committed
calendar UX improvements
1 parent ae25d56 commit add09c0

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/components/cellTypes/CalendarCell.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const CalendarCell = (calendarProps: CellComponentProps) => {
5151
columnsInfo.getAllColumns(),
5252
configInfo.getLocalSettings()
5353
);
54-
setShowDatePicker(false);
5554
}
5655

5756
const CalendarContainer = (containerProps: any) => {
@@ -60,8 +59,11 @@ const CalendarCell = (calendarProps: CellComponentProps) => {
6059
);
6160
};
6261

63-
const onClickOutside = () => {
64-
setShowDatePicker(false);
62+
const closeEditCalendarCell = () => {
63+
// We need a delay to allow the click event of clearing the date to propagate
64+
setTimeout(() => {
65+
setShowDatePicker(false);
66+
}, 100);
6567
};
6668

6769
return showDatePicker ? (
@@ -74,7 +76,8 @@ const CalendarCell = (calendarProps: CellComponentProps) => {
7476
}
7577
onChange={handleCalendarChange}
7678
popperContainer={CalendarContainer}
77-
onClickOutside={onClickOutside}
79+
onClickOutside={closeEditCalendarCell}
80+
onCalendarClose={closeEditCalendarCell}
7881
autoFocus
7982
isClearable
8083
ariaLabelClose="Clear"

src/components/cellTypes/CalendarTimeCell.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
5252
columnsInfo.getAllColumns(),
5353
configInfo.getLocalSettings()
5454
);
55-
setShowDatePicker(false);
5655
}
5756

5857
const CalendarContainer = (containerProps: any) => {
@@ -61,6 +60,13 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
6160
);
6261
};
6362

63+
const closeEditCalendarTimeCell = () => {
64+
// We need a delay to allow the click event of clearing the date to propagate
65+
setTimeout(() => {
66+
setShowDatePicker(false);
67+
}, 100);
68+
};
69+
6470
return showDatePicker &&
6571
(tableColumn.isMetadata === undefined || !tableColumn.isMetadata) ? (
6672
<DatePicker
@@ -72,7 +78,8 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
7278
}
7379
onChange={handleCalendarChange}
7480
popperContainer={CalendarContainer}
75-
onClickOutside={() => setShowDatePicker(false)}
81+
onClickOutside={closeEditCalendarTimeCell}
82+
onCalendarClose={closeEditCalendarTimeCell}
7683
timeFormat="HH:mm"
7784
timeCaption="time"
7885
showTimeSelect

0 commit comments

Comments
 (0)