Skip to content

Commit 4960aaa

Browse files
committed
fix: menu placement issue with react dates
1 parent 0cd8abb commit 4960aaa

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/Shared/Components/DatePicker/DateTimePicker.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const DateTimePicker = ({
5050
isTodayBlocked = false,
5151
dataTestIdForTime = DATE_PICKER_IDS.TIME,
5252
dataTestidForDate = DATE_PICKER_IDS.DATE,
53+
openDirection = 'down',
5354
}: DateTimePickerProps) => {
5455
const time = getTimeValue(dateObject)
5556
const selectedTimeOption = DEFAULT_TIME_OPTIONS.find((option) => option.value === time) ?? DEFAULT_TIME_OPTIONS[0]
@@ -84,7 +85,7 @@ const DateTimePicker = ({
8485
focused={isFocused}
8586
onFocusChange={handleFocusChange}
8687
numberOfMonths={1}
87-
openDirection="down"
88+
openDirection={openDirection}
8889
renderCalendarDay={(props) => <CustomizableCalendarDay {...props} {...customDayStyles} />}
8990
hideKeyboardShortcutsPanel
9091
withFullScreenPortal={false}
@@ -96,6 +97,7 @@ const DateTimePicker = ({
9697
data-testid={dataTestidForDate}
9798
isDayBlocked={isDayBlocked}
9899
disabled={disabled}
100+
appendToBody
99101
/>
100102
{!hideTimeSelect && (
101103
<div className="dc__no-shrink">

src/Shared/Components/DatePicker/datePicker.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
.date-time-picker {
18-
.DayPicker__horizontal {
19-
position: fixed !important;
20-
}
17+
.SingleDatePicker_picker {
18+
z-index: calc(var(--modal-index) + 1) !important;
19+
}
2120

21+
.date-time-picker {
2222
.SingleDatePicker {
2323
width: 100%;
2424
}

src/Shared/Components/DatePicker/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import { Moment } from 'moment'
1818
import { SelectInstance } from 'react-select'
19+
import { SingleDatePickerShape } from 'react-dates'
1920
import { OptionType } from '../../../Common'
2021

2122
export interface SingleDatePickerProps {
@@ -100,10 +101,8 @@ export interface TimeSelectProps {
100101
}
101102

102103
export interface DateTimePickerProps
103-
extends Pick<
104-
TimeSelectProps,
105-
'date' | 'onChange' | 'timePickerProps' | 'error' | 'disabled' | 'dataTestIdForTime'
106-
> {
104+
extends Pick<TimeSelectProps, 'date' | 'onChange' | 'timePickerProps' | 'error' | 'disabled' | 'dataTestIdForTime'>,
105+
Pick<SingleDatePickerShape, 'openDirection'> {
107106
/**
108107
* Props for the date picker
109108
*/

0 commit comments

Comments
 (0)